Cometchat flutter v5 production
Skill cometchat/cometchat-skills/skills/cometchat-flutter-v5-production
Add CometChat chat & messaging and voice & video calls to any React, Next.js, React Native, Angular, Android, iOS, or Flutter project through your AI coding agent. Works with Claude Code, Cursor, Codex, VS Code Copilot, Windsurf, Cline, Kiro, and 50+ more agents.
npx -y skills add cometchat/cometchat-skills --skill cometchat-flutter-v5-productionAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
What its author says it does
Copied from the file, not written here
Use when preparing a CometChat Flutter UIKit v5 app for production. Covers auth tokens, ProGuard, environment config, security hardening.
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
6.1 KB, ~1.4k tokens by cl100k_base, as published. Nobody here has run it
Ground truth:
cometchat_chat_uikit: ^5.2(legacy/maintenance-only; calls via rawcometchat_calls_sdk ^5.0.2) — pub-cache source +ui-kit/flutter/v5. Official docs: https://www.cometchat.com/docs/fundamentals/user-auth · 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 — Production
Hardening a CometChat Flutter app for production deployment.
Auth Tokens vs Auth Key
Development: CometChatUIKit.login(uid) uses authKey from UIKitSettingsBuilder. This is convenient but insecure — the authKey is embedded in the app binary.
Production: Use server-minted auth tokens via CometChatUIKit.loginWithAuthToken(authToken):
// 1. Your backend generates an auth token via CometChat REST API
// POST https://{appId}.api-{region}.cometchat.io/v3/users/{uid}/auth_tokens
// Header: apiKey: YOUR_API_KEY
// 2. Your Flutter app receives the token and logs in
CometChatUIKit.loginWithAuthToken(authToken,
onSuccess: (user) { ... },
onError: (e) { ... },
);
This keeps the API key on your server, never in the client.
Environment Configuration
Store credentials outside source code:
class AppCredentials {
static String _appId = '';
static String _authKey = '';
static String _region = '';
// Load from SharedPreferences, environment, or remote config
static String get appId => _appId.isEmpty
? SharedPreferencesClass.getString('appId')
: _appId;
static Future<void> setAppId(String value) async {
await SharedPreferencesClass.setString('appId', value);
_appId = value;
}
}
The master app supports QR code scanning to load credentials dynamically (CometChatQRScreen).
Android Build Requirements
gradle.properties
android.useAndroidX=true
android.enableJetifier=true
minSdk
// android/app/build.gradle
defaultConfig {
minSdk 24 // Matches vendor samples (sample_app + sample_app_push_notifications + calls_uikit android/build.gradle).
// Raw calls-sdk docs cite 26; the UI Kit wrapper relaxes to 24 for chat-only apps.
// Bump to 26 ONLY if your app uses calls AND fails at runtime with a min-SDK error from the calls plugin.
}
ProGuard / R8 Keep Rules
Create android/app/proguard-rules.pro:
-keep class com.cometchat.** { *; }
-keep interface com.cometchat.** { *; }
-dontwarn com.cometchat.calls.**
Reference in build.gradle:
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
Signing
signingConfigs {
release {
storeFile file('your_keystore.jks')
storePassword 'STORE_PASSWORD'
keyAlias 'KEY_ALIAS'
keyPassword 'KEY_PASSWORD'
}
}
iOS Build Requirements
Info.plist Permissions
<key>NSCameraUsageDescription</key>
<string>Camera access for video calls and photo sharing</string>
<key>NSMicrophoneUsageDescription</key>
<string>Microphone access for voice and video calls</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Photo library access for sharing images</string>
Background Modes (for VoIP)
Enable in Xcode: Background Modes → Voice over IP, Remote notifications, Background fetch.
Podfile
Ensure minimum iOS deployment target matches CometChat requirements.
Firebase Setup
// In main(), before runApp:
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
Crashlytics
FlutterError.onError = (errorDetails) {
FirebaseCrashlytics.instance.recordFlutterFatalError(errorDetails);
};
PlatformDispatcher.instance.onError = (error, stack) {
FirebaseCrashlytics.instance.recordError(error, stack, fatal: true);
return true;
};
Push Notification Provider IDs
Configure provider IDs for FCM and APNs in the CometChat dashboard:
static String get fcmProviderId => 'your-fcm-provider-id';
static String get apnProviderId => 'your-apn-provider-id';
These must match what's configured in the CometChat dashboard under Notifications → Push Notifications.
Demo Meta Info
For internal tracking (optional):
CometChat.setDemoMetaInfo(jsonObject: {
"name": "flutter-sample-app",
"type": "sample",
"version": "5.2.11",
"platform": "flutter",
});
Logout Flow
// 1. Unregister push tokens — real SDK API:
await CometChatNotifications.unregisterPushToken(
onSuccess: (_) {},
onError: (e) {},
);
// (PNRegistry.unregisterPNService() only works if you copied the v5 sample-app
// `extension PNRegistry on CometChatService` helper into your project — it is
// NOT importable from any cometchat_* package. See cometchat-flutter-v5-push.)
// 2. Sign out from Firebase/Google (if applicable)
await FirebaseAuth.instance.signOut();
await GoogleSignIn().signOut();
// 3. Logout from CometChat
await CometChatUIKit.logout(
onSuccess: (_) { /* navigate to login */ },
onError: (e) { /* show error */ },
);
Checklist — Production
- Auth tokens minted server-side, not authKey in client
- Credentials not hardcoded in source (use SharedPreferences or remote config)
- ProGuard rules added for release builds
- minSdk 24 set (or 26 if your app uses calls AND hits min-SDK runtime errors)
- iOS permissions in Info.plist
- Firebase Crashlytics configured
- Push notification provider IDs match CometChat dashboard
- Logout unregisters push tokens before CometChat logout
- Signing config set for release builds
Gives 0 of the 12 instructions most security skills give in ~1.4k tokens
Counted across 648 of the 828 authors here whose files we hold, read 2026-08-06
- parameterize all database queriesin 67 of 648, across 49 files
- hash passwords using bcrypt scrypt or argon2in 48 of 648, across 35 files
- apply rate limiting to authentication endpointsin 48 of 648, across 24 files
- Configure security headersin 35 of 648, across 18 files
- validate all inputsin 32 of 648, across 24 files
- validate all external input at the system boundaryin 29 of 648, across 18 files
- run containers as a non-root userin 28 of 648, across 15 files
- use httponly secure samesite cookies for sessionsin 26 of 648, across 15 files
- run dependency audits before every releasein 21 of 648, across 10 files
- encode output to prevent cross-site scriptingin 21 of 648, across 10 files
- copy dependencies before source codein 20 of 648, across 9 files
- store secrets in environment variablesin 20 of 648, across 17 files
Said here and by no other author read
- use server-minted auth tokens for production login
- store credentials outside source code
- add ProGuard keep rules for release builds
- set minimum SDK version to 24
- declare iOS permissions in Info.plist
- configure Firebase Crashlytics to record errors
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.