Overview
Events allow for a decoupled, flexible architecture where different parts of the application can interact without having to directly reference each other. This makes it easier to create complex, interactive experiences, as well as to extend and customize the functionality provided by the CometChat UI Kit.The event system is identical between V5 and V6. All event classes, listeners, and APIs work the same way.
User Events
CometChatUserEvents emit events when the logged-in user executes actions on another user.
ccUserBlocked: Triggered when the logged-in user blocks another user.ccUserUnblocked: Triggered when the logged-in user unblocks another user.
- Dart
Group Events
CometChatGroupEvents emits events when the logged-in user performs actions related to groups.
ccGroupCreated: Triggered when the logged-in user creates a group.ccGroupDeleted: Triggered when the logged-in user deletes a group.ccGroupLeft: Triggered when the logged-in user leaves a group.ccGroupMemberScopeChanged: Triggered when the logged-in user changes the scope of another group member.ccGroupMemberBanned: Triggered when the logged-in user bans a group member.ccGroupMemberKicked: Triggered when the logged-in user kicks a group member.ccGroupMemberUnbanned: Triggered when the logged-in user unbans a user.ccGroupMemberJoined: Triggered when the logged-in user joins a group.ccGroupMemberAdded: Triggered when the logged-in user adds new members.ccOwnershipChanged: Triggered when the logged-in user transfers ownership.
- Dart
Message Events
CometChatMessageEvents emits events related to messages.
- Dart
Conversation Events
CometChatConversationEvents emits events related to conversations.
ccConversationDeleted: Triggered when a conversation is deleted.
- Dart
UI Events
CometChatUIEvents emits CometChatUIEventListener callbacks for UI-level actions such as panel visibility, active chat changes, and card action taps. Add a listener with CometChatUIEvents.addUiListener(listenerId, this) and remove it in dispose().
Event types:
| Event | Description |
|---|---|
showPanel(id, uiPosition, child) | Triggered to show an additional UI panel with custom elements. |
hidePanel(id, uiPosition) | Triggered to hide a previously shown UI panel. |
ccActiveChatChanged(id, lastMessage, user, group, unreadMessageCount) | Triggered when the active chat changes. |
openChat(user, group) | Triggered to open a chat with a specific user or group. |
ccComposeMessage(text, status) | Triggered when composing a message with a specific text and status. |
onAiFeatureTapped(user, group) | Triggered when an AI feature is tapped for a specific user or group. |
ccCardActionClicked(message, action) | Triggered when a user taps an interactive element (button/link) inside a card message (CardMessage) or an AI agent card (AIAssistantMessage). action is typed dynamic; cast it to CometChatCardActionEvent. |
- Dart
The UI Kit renders card bubbles automatically (
CometChatCardBubble) and emits ccCardActionClicked when a user taps an action inside one — so a single subscriber handles every card action across your app. message is a CardMessage for standalone card messages and an AIAssistantMessage for cards embedded in AI agent replies. Cast action to CometChatCardActionEvent to read its action, elementId, and cardJson. See also Methods → UI Events — Card Actions.