Skip to content
OpenSmartRoute
Skillv1.0.0

cometchat-flutter-v5-events

Use when working with CometChat Flutter UIKit v5 event system. Triggers on CometChatMessageEvents, CometChatUserEvents, CometChatGroupEvents, CometChatCallEvents, CometChatUIEvents, listeners.

by cometchat(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from cometchat/cometchat-skills (skills/cometchat-flutter-v5-events/SKILL.md). Install upstream with npx skills add cometchat/cometchat-skills --skill cometchat-flutter-v5-events. Copyright stays with the author (MIT).

Ground truth: cometchat_chat_uikit: ^5.2 (legacy/maintenance-only; calls via raw cometchat_calls_sdk ^5.0.2) — pub-cache source + ui-kit/flutter/v5. Official docs: https://www.cometchat.com/docs/ui-kit/flutter/v5/overview · Docs MCP: claude mcp add --transport http cometchat-docs https://www.cometchat.com/docs/mcp (or fetch the URL directly without MCP). Verify symbols against the installed package/source before relying on them.

CometChat Flutter UIKit v5 — Events

Two layers: SDK listeners (low-level) and UIKit events (high-level component coordination).

Event System Architecture

Layer 1: SDK Listeners (CometChat SDK)

Raw message/call/user/group events from the network.

Layer 2: UIKit Events (CometChat UIKit)

High-level events emitted by UIKit components for UI coordination. Use a static Map<String, Listener> pattern.

Listener Registration Pattern

All event classes follow the same register/remove pattern:

// ✅ CORRECT — register in initState, remove in dispose
class _MyWidgetState extends State<MyWidget> {
  late final String _listenerId;

  @override
  void initState() {
    super.initState();
    _listenerId = 'my_widget_${DateTime.now().millisecondsSinceEpoch}';

    // UIKit events
    CometChatMessageEvents.addMessagesListener(_listenerId, this);
    CometChatUIEvents.addUiListener(_listenerId, this);

    // SDK listeners
    CometChat.addMessageListener(_listenerId, this);
    CometChat.addUserListener(_listenerId, this);
    CometChat.addGroupListener(_listenerId, this);
    CometChat.addCallListener(_listenerId, this);
  }

  @override
  void dispose() {
    CometChatMessageEvents.removeMessagesListener(_listenerId);
    CometChatUIEvents.removeUiListener(_listenerId);
    CometChat.removeMessageListener(_listenerId);
    CometChat.removeUserListener(_listenerId);
    CometChat.removeGroupListener(_listenerId);
    CometChat.removeCallListener(_listenerId);
    super.dispose();
  }
}

For GetxController, use onInit() / onClose() instead of initState() / dispose().

UIKit Event Classes — Registration

Class Register Remove
CometChatMessageEvents addMessagesListener(id, listener) removeMessagesListener(id)
CometChatUserEvents addUsersListener(id, listener) removeUsersListener(id)
CometChatGroupEvents addGroupsListener(id, listener) removeGroupsListener(id)
CometChatCallEvents addCallEventsListener(id, listener) removeCallEventsListener(id)
CometChatUIEvents addUiListener(id, listener) removeUiListener(id)
CometChatConversationEvents addConversationListListener(id, listener) removeConversationListListener(id)

SDK Listeners — Registration

Listener Register Remove
Messages CometChat.addMessageListener(id, this) CometChat.removeMessageListener(id)
Users (online/offline) CometChat.addUserListener(id, this) CometChat.removeUserListener(id)
Groups CometChat.addGroupListener(id, this) CometChat.removeGroupListener(id)
Calls CometChat.addCallListener(id, this) CometChat.removeCallListener(id)
Connection CometChat.addConnectionListener(id, this) CometChat.removeConnectionListener(id)

Key UIKit Events (commonly used)

CometChatUIEvents:

  • openChat(User? user, Group? group) — request to open a chat

CometChatMessageEvents:

  • ccMessageSent(BaseMessage message, MessageStatus status) — message sent
  • ccMessageEdited(BaseMessage message, MessageEditStatus status) — message edited
  • ccMessageDeleted(BaseMessage message, EventStatus status) — message deleted

CometChatUserEvents:

  • ccUserBlocked(User user) / ccUserUnblocked(User user)

CometChatGroupEvents:

  • ccGroupMemberKicked, ccGroupMemberBanned, ccGroupMemberAdded, ccOwnershipChanged

CometChatCallEvents:

  • ccOutgoingCall(Call), ccCallAccepted(Call), ccCallRejected(Call), ccCallEnded(Call)

UIKit Events vs SDK Listeners

  • UIKit events — react to UIKit-level actions (message sent via composer, group created via UI, user blocked via UI)
  • SDK listeners — raw network events (message received, user online/offline, group member joined)
  • UIKit components internally use both

Gotchas

Unique Listener IDs

// ❌ WRONG — hardcoded ID
CometChat.addMessageListener('messages', this);

// ✅ CORRECT — unique ID
final id = 'messages_${DateTime.now().millisecondsSinceEpoch}';
CometChat.addMessageListener(id, this);

Always Remove in dispose()

// ❌ WRONG — listener leaks
@override
void dispose() {
  super.dispose();
}

// ✅ CORRECT
@override
void dispose() {
  CometChat.removeMessageListener(_listenerId);
  super.dispose();
}

Never Register in build()

// ❌ WRONG — called every rebuild
@override
Widget build(BuildContext context) {
  CometChat.addMessageListener(id, this);
  return Container();
}

Checklist — Events

  • Listener ID is unique (use timestamp or hashCode)
  • Listener registered in initState() / onInit(), not build()
  • Listener removed in dispose() / onClose() with same ID
  • UIKit events for UI coordination, SDK listeners for raw events
  • subscriptionType set in UIKitSettings for presence events to work

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/cometchat-cometchat-skills-cometchat-flutter-v5-events/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

cometchat-cometchat-skills-cometchat-flutter-v5-events.ocm.jsonjson
{
  "ocm": "1",
  "id": "cometchat-cometchat-skills-cometchat-flutter-v5-events",
  "kind": "skill",
  "name": "cometchat-flutter-v5-events",
  "description": "Use when working with CometChat Flutter UIKit v5 event system. Triggers on CometChatMessageEvents, CometChatUserEvents, CometChatGroupEvents, CometChatCallEvents, CometChatUIEvents, listeners.",
  "publisher": "cometchat",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "general"
    ],
    "tags": [
      "skill-md",
      "cometchat",
      "flutter",
      "v5",
      "events",
      "listeners",
      "real-time",
      "typing",
      "receipts",
      "skills-sh"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Use when working with CometChat Flutter UIKit v5 event system. Triggers on CometChatMessageEvents, CometChatUserEvents, CometChatGroupEvents, CometChatCallEvents, CometChatUIEvents, listeners."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "skills.sh",
      "repository": "https://github.com/cometchat/cometchat-skills",
      "path": "skills/cometchat-flutter-v5-events/SKILL.md",
      "ref": "HEAD",
      "url": "https://github.com/cometchat/cometchat-skills/blob/HEAD/skills/cometchat-flutter-v5-events/SKILL.md",
      "key": "cometchat/cometchat-skills/skills/cometchat-flutter-v5-events/SKILL.md"
    },
    "compatibility": "cometchat_uikit_shared ^5.2.3; cometchat_sdk ^4.1.2",
    "license": "MIT"
  },
  "instructions": "> **Ground truth:** `cometchat_chat_uikit: ^5.2` (legacy/maintenance-only; calls via raw `cometchat_calls_sdk ^5.0.2`) — pub-cache source + `ui-kit/flutter/v5`. **Official docs:** https://www.cometchat.com/docs/ui-kit/flutter/v5/overview · **Docs MCP:** `claude mcp add --transport http cometchat-docs https://www.cometchat.com/docs/mcp` (or fetch the URL directly without MCP). Verify symbols against the installed package/source before relying on them.\n\n# CometChat Flutter UIKit v5 — Events\n\nTwo layers: SDK listeners (low-level) and UIKit events (high-level component coordination).\n\n## Event Sys",
  "cost": {
    "context_tokens": 1345
  }
}

Fetch it by URL: GET /api/v1/registry/cometchat-cometchat-skills-cometchat-flutter-v5-events/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.