/cometchat-skills:cometchat-flutter-v6-eventsfrom cometchat-skills
Guides Flutter developers on reacting to CometChat activity via SDK listeners (messages, calls, users, groups, connection) and UI Kit events (CometChatMessageEvents, CometChatGroupEvents, etc.), including listener lifecycle to prevent leaks.
Ships in cometchat-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Ground truth: every listener symbol below is catalog-verified against 6.1.0. There are TWO event systems and they are not interchangeable — the exact callback set for each is FETCHED from
events(UI events) and the SDK'sreal-time-listenersvia../cometchat-flutter-v6-core/references/docs-map.md.
cometchat-flutter-v6-core — install, credentials, init→login→render. This skill ASSUMES it."do something when a message arrives", "update a badge count", "refresh my screen when a group changes", "cometchat listener" — anything reactive OUTSIDE what the kit's widgets already do for themselves.
Covered by core. No new package.
The kit's widgets are already live. CometChatConversations updates its own unread counts, CometChatMessageList appends incoming messages, CometChatMessageHeader shows typing and presence — all without a single listener from you. Add one only for something OUTSIDE the kit's surface: an app-level badge, an analytics hook, a push registration, navigating on an incoming call.
Adding a listener to "make the list update" is the most common mistake here — it already does.
| SDK listeners | UI Kit events | |
|---|---|---|
| Source | the server, via CometChat.* | the kit's own widgets |
| Register | CometChat.addMessageListener(id, this) | CometChatMessageEvents.addMessagesListener(id, this) |
| Mixin | MessageListener · CallListener · UserListener · GroupListener · ConnectionListener | CometChatMessageEventListener · CometChatGroupEventListener · CometChatUserEventListener · CometChatConversationEventListener |
| Answers | "the server says X happened" | "the user did X in the kit" |
| Use for | badges, push, incoming calls, analytics | reacting to a kit action (message sent from the composer, group left via the kit) |
SDK listener — server-side truth:
import 'package:cometchat_chat_uikit/cometchat_chat_uikit.dart';
import 'package:flutter/material.dart';
class BadgeHost extends StatefulWidget {
const BadgeHost({super.key});
@override
State<BadgeHost> createState() => _BadgeHostState();
}
class _BadgeHostState extends State<BadgeHost> with MessageListener {
static const _id = "app_badge";
@override
void initState() {
super.initState();
CometChat.addMessageListener(_id, this);
}
@override
void dispose() {
CometChat.removeMessageListener(_id); // ALWAYS remove — see lifecycle below
super.dispose();
}
@override
void onTextMessageReceived(TextMessage message) {
// bump an app-level unread badge
}
@override
Widget build(BuildContext context) => const SizedBox.shrink();
}
UI Kit event — react to what the kit did:
import 'package:cometchat_chat_uikit/cometchat_chat_uikit.dart';
import 'package:flutter/material.dart';
class ComposerWatcher extends StatefulWidget {
const ComposerWatcher({super.key});
@override
State<ComposerWatcher> createState() => _ComposerWatcherState();
}
class _ComposerWatcherState extends State<ComposerWatcher> with CometChatMessageEventListener {
static const _id = "composer_watch";
@override
void initState() {
super.initState();
CometChatMessageEvents.addMessagesListener(_id, this);
}
@override
void dispose() {
CometChatMessageEvents.removeMessagesListener(_id);
super.dispose();
}
@override
Widget build(BuildContext context) => const SizedBox.shrink();
}
initState, remove in dispose — always paired.initState. A listener you never removed fires again, so a badge double-counts and a call dialog opens twice.login resolves receives nothing.MessageListener (SDK) and CometChatMessageEventListener (UI Kit) both declare onCardMessageReceived, but with two different CardMessage types — one from cometchat_sdk, one from the kit. Mixing them on the same State fails to compile with invalid_override. Use two separate classes (or two States) when you need both.
dispose removal → duplicate events after hot restart / re-entry.DataSource/ChatConfigurator event plumbing is gone (→ -migration).The reaction fires once (not twice) per event; hot-restart the app and confirm it still fires exactly once; navigate away and back and confirm no duplicate; with the app backgrounded, server-side events still arrive when it returns.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub cometchat/cometchat-skills --plugin cometchat-skills98 skills in this plugin
/cometchatEntry point for any CometChat task on any platform. Detects the framework + UI Kit version (React, Angular, iOS, Android, React Native, Flutter), then routes to that family's skills — for a NEW integration or a change to an existing one. Triggers: 'add chat', 'add cometchat', 'add chat to my app', 'add calling', 'change something in my chat', 'my chat is already set up', 'add a feature to the chat', 'add chat to my android app', 'integrate cometchat android', 'add chat to my ios app', 'integrate cometchat ios', 'add chat to my swift app', 'migrate my app to cometchat', 'migrate from sendbird', 'migrate from getstream / stream', 'replace sendbird / stream chat with cometchat', 'build a <app> clone', 'make a chat app like <app>', 'make it look and work like <app>'./cometchat-a11yKeep a CometChat integration accessible — the UI Kit is designed targeting WCAG 2.1 AA with keyboard navigation (verify per component in its docs; full conformance still needs manual testing), and this skill makes sure the HOST app doesn't break that, covering contrast, focus, screen-reader context, reduced motion, RTL, and calls accessibility. Cross-family. Triggers: 'is cometchat accessible', 'WCAG / 508 / ADA compliance', 'screen reader support', 'keyboard navigation', 'a11y audit', 'accessible chat', 'contrast/focus issues in chat'.Other plugins' skills for the same job