/cometchat-skills:cometchat-flutter-v5-sdkfrom cometchat-skills
Adds voice/video calling to Flutter apps using the headless CometChat Calls SDK v5. Covers init, login, token generation, session joining, in-call controls, and both meet-style rooms and 1:1 ringing.
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.
Read when SKILL.md points to them.
Ground truth:
cometchat_calls_sdk5.0.7 from pub.dev + catalogflutter-calls-v5.json(the closed symbol list — 59 COMPILER-VERIFIED symbols; every type below is in it). Catalog built from the PUBLISHED package; at 5.0.7 it matches thecalls-coremonorepo exactly — but never infer that from a version string (references/docs-map.md§ "Upstream"). Official docs:/calls/flutter/**= v5 · Docs MCP. Fetch exactSessionSettingsfields, event names and signatures from the docs (references/docs-map.md) — never memory. ⚠️ The live pages carry ~56 symbols that DO NOT COMPILE, including the entire documented token flow — see "Doc corrections" below; prefer THIS skill's names over the page's. APPEND to the user's app — additive wiring only. This is the HEADLESS path (no UI Kit); for the prebuilt drop-in call UI usecometchat-flutter-v6-callsinstead.
-core sibling; self-contained for meet-style calling.cometchat_sdk v5) for signaling — signatures fetched via references/docs-map.md (§ "1:1 RINGING"). It does NOT depend on the Flutter UI Kit.cometchat-flutter-v6-core + cometchat-flutter-v6-calls — not this skill."add calling from scratch / without the UI Kit", "standalone voice/video on Flutter", "build my own call screen", "headless calls SDK", "meeting-room join by session id", "one-on-one ringing". Precondition: the caller chose the from-scratch / standalone path (the "add calling" router asks this). If they want the prebuilt call UI, route to cometchat-flutter-v6-calls.
# pubspec.yaml
dependencies:
cometchat_calls_sdk: ^5.0.9 # latest; API compiler-verified vs 5.0.7, unchanged through 5.0.9
then flutter pub get.
1:1 ringing additionally needs the Chat SDK (cometchat_sdk v5) for signaling.
Permissions — REQUIRED or the call dies on the first permission prompt.
android/app/src/main/AndroidManifest.xml: INTERNET, CAMERA, RECORD_AUDIO, MODIFY_AUDIO_SETTINGS, ACCESS_NETWORK_STATE. On API 23+ you must ALSO request camera + mic at runtime — the manifest alone is not enough, and this is the single most common "the SDK is broken" report on Android.ios/Runner/Info.plist: NSCameraUsageDescription + NSMicrophoneUsageDescription.minSdkVersion 26, iOS platform :ios, '15.1' — the real floors (5.0.7 through 5.0.9). The docs say 24 and iOS 12; both fail at BUILD time. iOS moved 13.0 → 15.1 in 5.0.7, so an app can break on a routine pub upgrade.Credentials: App ID · Region · Auth Key (dev only), fetched through the CometChat MCP — cometchat_whoami (connected + signed in?), cometchat_list_apps (ask which EXISTING app), cometchat_get_app_credentials, or pasted from Dashboard → Credentials. Mint auth tokens server-side for production; never ship the Auth Key.
Init (once, must succeed) → CometChatCalls.login(...) → then generateCallToken / joinSession / listeners. Nothing joins before init+login resolve. CometChatCalls.isInitialized is the guard.
DEFAULT to CometChatCalls.initFromSettings(onSuccess:, onError:) — the ai-agent / telemetry-attributed path (persists integrationSource="ai-agent").
It takes no settings argument: it reads cometchat-settings.json through rootBundle, so the file must sit at the project root and be registered as a Flutter asset:
flutter:
assets:
- cometchat-settings.json
Root keys appId + region; optional callsSDK → adminHost/clientHost/callsHost. No Auth Key — the Calls SDK reads nothing else from this file (the key is a login() argument). Registering it under flutter: assets: is the ONLY step; no Xcode or Gradle change, because it is read through rootBundle. Miss the assets: entry and init fails with settings-file-not-found — a quiet callback, not a crash.
Fallback (public-doc path):
CallAppSettings s = (CallAppSettingBuilder()..appId = appId..region = region).build();
CometChatCalls.init(s, onSuccess: (String m) {}, onError: (CometChatCallsException e) {});
Note the Dart cascade (..appId =) — these are fields, not setX() methods. CallAppSettingBuilder is singular (no s).
⚠️ Never do both. A builder init AFTER initFromSettings re-attributes the app to "manual" and the ai-agent telemetry is lost.
Login: CometChatCalls.login(uid:, authKey:, onSuccess:, onError:) (dev) or CometChatCalls.loginWithAuthToken(authToken:, onSuccess:, onError:) (production). Check await CometChatCalls.getLoggedInUser() first — it returns Future<User?> and the SDK keeps the session, so logging in twice is wasted work. Both onSuccess callbacks hand you a NULLABLE User? — the docs dereference it unguarded; do not copy that.
cometchat_sdk v5 as well. Fetch signatures via references/docs-map.md § "1:1 RINGING".joinSession returns a WIDGETEvery other platform mounts the call into a container you hand it. Flutter hands the call back to
you as a Widget? and mounts nothing:
Widget? _callWidget;
CometChatCalls.joinSession(
sessionId: sessionId,
sessionSettings: settings,
onSuccess: (Widget? w) => setState(() => _callWidget = w), // ← THIS is the render step
onError: (CometChatCallsException e) { /* surface it */ },
);
@override
Widget build(BuildContext c) => Scaffold(body: _callWidget ?? const CircularProgressIndicator());
An emit that ignores the onSuccess argument joins the call successfully and shows nothing — audio flows, no video, no controls. It reads as a broken SDK and it is the #1 Flutter-specific failure. There is no container parameter and no zero-bounds trap; there is only "did you put the widget in the tree".
CometChatCalls.initFromSettings · CometChatCalls.init · CallAppSettingBuilder → CallAppSettings · CometChatCalls.isInitialized · login · loginWithAuthToken · logout · getLoggedInUser → User?CometChatCalls.generateCallToken(sessionId, ...) → CallToken · joinSession(...) → Widget? · SessionSettingsBuilder → SessionSettings · SessionTypegenerateCallToken(sessionId) → joinSession(callToken:sessionSettings:), or joinSession(sessionId:sessionSettings:) directly.CallSession.getInstance(), for CUSTOM controls ONLY (the returned widget already renders them; see pitfall #1): leaveSession · muteAudio/unMuteAudio · pauseVideo/resumeVideo · setLayout · setAudioModeType · switchCamera · raiseHand/lowerHand · startRecording/stopRecording · startScreenShare/stopScreenShare/toggleScreenShare · pinParticipant/unPinParticipant · muteParticipant · pauseParticipantVideo · enablePictureInPictureLayout/disablePictureInPictureLayout · enterPipMode/isPipSupported · setChatButtonUnreadCount · isCallSessionActive
toggleMuteAudio · togglePauseVideo · toggleCameraSource · toggleRaiseHandendCallSession · startCallRecording/stopCallRecording · setCallLayoutTypehideSettingsPanel · openCallSettingsPanel · openVirtualBackgroundSettingsPanelisAudioMuted · isVideoPaused · isHandRaised · isRecording · isScreenSharing · isTranscribingCallSession.getInstance(); four are add/remove, LayoutListeners is a single-slot property): SessionStatusListeners · ParticipantEventListeners · MediaEventListeners · ButtonClickListeners · LayoutListenersCallLogRequestBuilder (top-level; FIELDS, no setX()) → CallLogRequest → fetchNext/fetchPrevious → CallLog (+ CallUser/CallGroup/CallEntity)CometChatOngoingCallService.launch() / .abort() — Android foreground service, no-op on iOSAudioMode (.speaker/.earpiece/.bluetooth) · SessionType · LayoutType (.tile/.spotlight/.sidebar) · CameraFacingA curated highlight, NOT the full surface. The authoritative closed list is the catalog (59 symbols, each proven by a
flutter analyzeprobe). A symbol is real iff it is in the catalog — confirm there, then fetch its signature from the page inreferences/docs-map.md.
All five listener types are abstract classes you IMPLEMENT — they are NOT constructible.
The live docs build every one of them with named callbacks
(SessionStatusListeners(onSessionJoined: () {...})); an abstract class cannot be instantiated, so
none of those examples compile. flutter analyze reports instantiate_abstract_class.
class _Status extends SessionStatusListeners {
@override void onSessionJoined() { /* ... */ }
@override void onSessionTimedOut() { /* distinct from onSessionLeft — handle BOTH */ }
// `extends` instead of `implements` and the other four inherit their no-op bodies.
}
final _status = _Status(); // hoist into a FIELD
CallSession.getInstance()?.addSessionStatusListener(_status); // BEFORE joining
// teardown:
CallSession.getInstance()?.removeSessionStatusListener(_status); // the SAME instance
CallSession.getInstance()?.leaveSession();
extends lets you override only what you need; implements obliges you to write them all.remove*Listener takes the object you added. Constructing a fresh listener to remove one is a no-op that silently leaks the original — and it is what the live docs show (D4). Hoist into a field; there is no other shape in which removal works.references/docs-map.md. Two you cannot guess: MediaEvent**Listeners** registers via addMediaEvent**s**Listener, and LayoutListeners has no add/remove at all — it is a single-slot layoutListener = l setter, cleared with = null.CallSession.getInstance() is never actually null — the singleton is eagerly built, so registering BEFORE joinSession really does attach (certified: onSessionJoined fires). The type is still CallSession?, so keep ?.; use isCallSessionActive() to test for a live session.ButtonClickListeners callbacks fire alongside the SDK's own action and do NOT suppress it. Reacting to onLeaveSessionButtonClicked must NOT also call leaveSession() — the SDK is already leaving; doing both double-leaves. Use it to run CometChat.endCall(sessionId) on the ringing path.Participant has TWELVE fields, all nullable: uid · name · avatar · mid · state · isJoined · deviceId · joinedAt · leftAt · totalAudioMinutes · totalVideoMinutes · totalDurationInMinutes. No mute/pin/hand/share flags — the seven the docs' "Participant Object Reference" lists (pid/role/audioMuted/videoPaused/isPinned/isPresenting/raisedHandTimestamp) do NOT exist and do not compile (see doc-corrections.md); accumulate that live state from ParticipantEventListeners, as iOS must. Prefer onParticipantListChanged, which delivers the WHOLE list. (Participants, plural, is a @Deprecated typedef alias of Participant.)// Fetch every signature/field from references/docs-map.md. This is the ORDER, which is the part that bites.
import 'package:cometchat_calls_sdk/cometchat_calls_sdk.dart';
1. CometChatCalls.initFromSettings(onSuccess:, onError:) // ai-agent default; cometchat-settings.json as a Flutter ASSET
2. CometChatCalls.login(uid:, authKey:, onSuccess:, onError:) // or loginWithAuthToken in production
3. final settings = (SessionSettingsBuilder()..setDisplayName(name)..setType(SessionType.video)).build();
4. CallSession.getInstance()?.addSessionStatusListener(_status); // register BEFORE joining
5. CometChatCalls.joinSession(sessionId:, sessionSettings:, onSuccess: (Widget? w) => setState(() => _call = w), onError:)
// or: generateCallToken(sessionId) -> joinSession(callToken:sessionSettings:)
6. // return _call from build() — NOTHING renders until you do
7. // NO control buttons needed — the returned widget ALREADY renders mute/video/leave.
8. // teardown -> remove each listener (same instance); CallSession.getInstance()?.leaveSession()
references/platform-notes.mdTwo things that are NOT on the join path and are easy to get wrong:
CometChatOngoingCallService.launch() holds a foreground service (.abort() on teardown).
Flutter-only; both calls are safe no-ops on iOS. The manifest permissions are not optional.cometchat_push_notifications Flutter package invented it.references/doc-corrections.md)23 classes of symbol on /calls/flutter/** fail flutter analyze against 5.0.7. Read
references/doc-corrections.md before copying off a page. The two that bite hardest:
| The docs write | It does not compile — use |
|---|---|
generateToken(sessionId: ...) → CallToken (13 pages) | generateCallToken(sessionId, onSuccess:, onError:) → CallToken. generateToken is @Deprecated, takes two POSITIONAL args, and yields GenerateToken. No page mentions generateCallToken at all |
Participant.pid / .role / .audioMuted / .videoPaused / .isPinned / .isPresenting / .raisedHandTimestamp | None exist. Participant has 7 fields; track the rest from events |
Docs PR cometchat/docs#492 fixes the first seven classes (56 → 3 analyzer errors). Five more —
including the abstract-listener one — were found by running flutter analyze over this skill's
own harness AFTER #492 was open, and are not in it. 12 fences on those pages parse in no shape
and were never machine-checked, so the table is a floor, not a total.
joinSession renders nothing itself. Store the Widget? from onSuccess in State and return it from build().CallSession.getInstance() action methods are for CUSTOM controls ONLY — reach for them just when the user EXPLICITLY asks to replace the defaults, and hide the built-ins first via the ..hide*Button setters on SessionSettingsBuilder. To merely REACT to the built-in leave button, use ButtonClickListeners(onLeaveSessionButtonClicked:) — do not add a second button.remove*Listener matches by instance.User is exported by BOTH barrels — ringing imports both SDKs; ambiguous_import until one is imported with a prefix (... as calls;, then calls.CallSession etc.). No page says so.leaveSession() ends your media, CometChat.endCall(sessionId) tells the peer and completes the log. Only the first, and the peer still thinks the call is live.cancelCall — cancel your own outgoing call with rejectCall(sessionId, CometChatCallStatus.cancelled).minSdkVersion left at Flutter's default — the floor is 26 (docs say 24), in android/app/build.gradle.kts on current Flutter, not android/build.gradle.CometChatWebRTC excludes arm64, so the app builds x86_64 — fine on an iOS 18 simulator (Rosetta), impossible on iOS 26+. Device or iOS 18 sim; details in references/platform-notes.md.cometchat-settings.json not in flutter: assets: — initFromSettings fails with settings-file-not-found. It is a quiet error callback, not a crash. Registering the asset is the whole job; no Xcode step.init after initFromSettings silently re-attributes telemetry to "manual".onSessionLeft but not onSessionTimedOut — idle timeout (default 300s, 0 disables) fires a DIFFERENT callback; miss it and the user sits on a dead call screen.enablePictureInPictureLayout() is the in-app layout, enterPipMode() is Android system PiP.CallSession.getInstance() has real startScreenShare()/stopScreenShare()/toggleScreenShare() + an isScreenSharing getter (barrel-reachable in 5.0.7; the method channel invokes a native startScreenShare and web routes to getDisplayMedia), and hideScreenSharingButton defaults to false so the built-in button is visible. From 5.0.8, Android local share is opt-in: without two manifest entries the plugin hides the share button (references/platform-notes.md → Screen share on Android). So an emit calling startScreenShare() COMPILES and dispatches — never say local screen share is impossible or "invented." The /calls/flutter/screen-sharing DOC page still says "receive-only" — it documents only the RECEIVE side (onParticipantStartedScreenShare, participant.isPresenting, viewing a web participant's share); the shipped local-share control API is undocumented there. Reflect the shipped methods, and note the page lags them.SessionSettings fields and action params are FETCHED from docs, never guessed.cometchat_calls_sdk symbol emitted appears in flutter-calls-v5.json (node test-suite/scripts/verify-catalog.mjs --family flutter-calls-v5).cometchat_calls_sdk (5.0.7) with flutter analyze in test-suite/harness/flutter-calls.references/docs-map.md § "1:1 RINGING".What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
cometchat, calls-sdk, webrtc, flutter-calling, headless-calling
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