cometchat/cometchat-uikit-flutter/cometchat-flutter-uikit

Claude Code and agent skill by cometchat/cometchat-uikit-flutter

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Use when building chat with CometChat Flutter UIKit v6 (cometchat_chat_uikit). Triggers on CometChatUIKit, CometChatConversations, CometChatMessageList, CometChatMessageComposer, CometChatMessageHeader, CometChatUsers, CometChatGroups, UIKitSettings, CometChatThemeHelper, CometChatColorPalette, ConversationsBloc, MessageListBloc, CometChatTextBubble, CometChatImageBubble, CometChatMessageBubble, CometChatMentionsFormatter, SliverSpacing, ERR_ALREADY_LOGGED_IN, ERR_INVALID_REGION, authentication…

Install

npx vskill@latest install cometchat/cometchat-uikit-flutter/cometchat-flutter-uikit

SKILL.md

The same SKILL.md was published earlier as cometchat/cometchat-uikit-flutter/cometchat-flutter-uikit.

CometChat Flutter UIKit v6 — Orchestrator

Entry point skill for the cometchat_chat_uikit package. Routes to feature skills based on context.

Project Detection

Confirm the project uses CometChat UIKit by checking pubspec.yaml for:

yaml
dependencies:
cometchat_chat_uikit:
hosted: https://dart.cloudsmith.io/cometchat/cometchat/
version: 6.0.0-beta2

If missing, install via:

bash
dart pub add cometchat_chat_uikit:6.0.0-beta2 --hosted-url https://dart.cloudsmith.io/cometchat/cometchat/

Call functionality is built into cometchat_chat_uikit — no separate package needed. To use call-specific types, import the calls barrel:

dart
import 'package:cometchat_chat_uikit/cometchat_chat_uikit.dart';
import 'package:cometchat_chat_uikit/cometchat_calls_uikit.dart'; // For call types

Skill Routing

User mentionsRoute to skill
init, login, logout, UIKitSettings, setup, credentials, appId, regioncometchat-flutter-core
theme, colors, dark mode, styling, CometChatColorPalette, CometChatSpacing, typography, Style classcometchat-flutter-theming
conversations, conversation list, recent chats, ConversationsBloccometchat-flutter-conversations
messages, message list, composer, header, keyboard, rich text, bubbles, send messagecometchat-flutter-messages
users, groups, group members, contacts, user listcometchat-flutter-users-groups
events, listeners, real-time, typing indicator, online status, receipts, SDK listenercometchat-flutter-events

Architecture Overview

The UIKit follows Clean Architecture + BLoC:

{component}/
├── bloc/ # BLoC, Events, State (Equatable)
├── domain/ # Use Cases, Repository interfaces
├── data/ # Repository impl, DataSources
├── di/ # ServiceLocator (singleton)
├── widgets/ # UI components
└── {component}.dart # Barrel export

All components: conversations, message_list, message_composer, message_header, users, groups, group_members, search, threaded_header, message_information.

Package Structure

chat_uikit/lib/
├── cometchat_chat_uikit.dart # Main barrel export (chat components)
├── cometchat_calls_uikit.dart # Calls barrel export
├── chat_ui/src/ # Chat components (conversations, messages, users, groups, etc.)
├── call_ui/src/ # Call components (incoming, outgoing, ongoing, call_logs)
└── shared_ui/ # Shared utilities (theme, events, formatters, models, views)

Rule: AUTH_CHECK_AFTER_INIT

After CometChatUIKit.init() completes (in its onSuccess), the static field CometChatUIKit.loggedInUser is already populated if a cached session exists. Use this synchronous check — do NOT call CometChat.getLoggedInUser() separately.

dart
// ✅ CORRECT — synchronous check after init completes
CometChatUIKit.init(
uiKitSettings: settings,
onSuccess: (_) {
final hasUser = CometChatUIKit.loggedInUser != null;
// Route to home or login based on hasUser
},
);
// ❌ WRONG — separate async getLoggedInUser call after init
CometChatUIKit.init(
uiKitSettings: settings,
onSuccess: (_) {
CometChat.getLoggedInUser(
onSuccess: (user) { ... }, // Unreliable when no session exists
onError: (e) { ... },
);
},
);

The init() method internally calls getLoggedInUser() and sets CometChatUIKit.loggedInUser before firing onSuccess. Calling it again is redundant and the callback-based version can silently fail when no session exists (the SDK logs "Please log in to CometChat before calling this method" and neither callback fires consistently).

This also applies to login() and loginWithAuthToken() — all three populate CometChatUIKit.loggedInUser before calling onSuccess.

dart
// ❌ ALSO WRONG — async UIKit getLoggedInUser after init (redundant native bridge round-trip)
CometChatUIKit.init(
uiKitSettings: settings,
onSuccess: (_) async {
final user = await CometChatUIKit.getLoggedInUser(); // Unnecessary!
if (user != null) { ... }
},
);
// ❌ ALSO WRONG — raw SDK getLoggedInUser (bypasses UIKit, unreliable)
User? existingUser = await CometChat.getLoggedInUser();

Golden Path — Minimal Chat App

dart
import 'package:cometchat_chat_uikit/cometchat_chat_uikit.dart';
// 1. Init (once, at app startup)
final settings = (UIKitSettingsBuilder()
..appId = 'YOUR_APP_ID'
..region = 'us'
..authKey = 'YOUR_AUTH_KEY'
..subscriptionType = CometChatSubscriptionType.allUsers)
.build();
await CometChatUIKit.init(uiKitSettings: settings);
// 2. Login (init may already have restored a session)
if (CometChatUIKit.loggedInUser == null) {
await CometChatUIKit.loginWithAuthToken('AUTH_TOKEN');
}
// 3. Show conversations
CometChatConversations(
onItemTap: (conversation) {
final user = conversation.conversationWith is User
? conversation.conversationWith as User : null;
final group = conversation.conversationWith is Group
? conversation.conversationWith as Group : null;
// Navigate to messages screen
},
)
// 4. Messages screen
Scaffold(
appBar: CometChatMessageHeader(
user: user,
group: group,
onBack: () => Navigator.pop(context),
),
body: Column(
children: [
Expanded(child: CometChatMessageList(user: user, group: group)),
CometChatMessageComposer(user: user, group: group),
],
),
)

Complete App Scaffold (main.dart)

Full working app with init → auth guard → login → home → logout. Copy-paste ready.

dart
import 'package:flutter/material.dart';
import 'package:cometchat_chat_uikit/cometchat_chat_uikit.dart';
const String appId = 'YOUR_APP_ID';
const String region = 'us';
const String authKey = 'YOUR_AUTH_KEY';
void main() => runApp(const MyApp());
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
bool _initializing = true;
bool _loggedIn = false;
@override
void initState() {
super.initState();
_initCometChat();
}
void _initCometChat() {
final settings = (UIKitSettingsBuilder()
..appId = appId
..region = region
..authKey = authKey
..subscriptionType = CometChatSubscriptionType.allUsers)
.build();
CometChatUIKit.init(
uiKitSettings: settings,
onSuccess: (_) {
// CometChatUIKit.loggedInUser is already set if a cached session exists
setState(() {
_loggedIn = CometChatUIKit.loggedInUser != null;
_initializing = false;
});
},
onError: (e) {
debugPrint('Init failed: ${e.message}');
setState(() => _initializing = false);
},
);
}
void _onLoginSuccess() => setState(() => _loggedIn = true);
void _onLogout() => setState(() => _loggedIn = false);
@override
Widget build(BuildContext context) {
return MaterialApp(
home: _initializing
? const Scaffold(body: Center(child: CircularProgressIndicator()))
: _loggedIn
? HomeScreen(onLogout: _onLogout)
: LoginScreen(onLoginSuccess: _onLoginSuccess),
);
}
}
// --- Login Screen ---
class LoginScreen extends StatefulWidget {
final VoidCallback onLoginSuccess;
const LoginScreen({super.key, required this.onLoginSuccess});
@override
State<LoginScreen> createState() => _LoginScreenState();
}
class _LoginScreenState extends State<LoginScreen> {
final _uidController = TextEditingController();
bool _loggingIn = false;
String? _error;
void _login() {
final uid = _uidController.text.trim();
if (uid.isEmpty) return;
setState(() { _loggingIn = true; _error = null; });
CometChatUIKit.login(uid,
onSuccess: (_) {
if (mounted) widget.onLoginSuccess();
},
onError: (e) {
if (mounted) setState(() { _loggingIn = false; _error = e.message; });
},
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Padding(
padding: const EdgeInsets.all(24),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TextField(
controller: _uidController,
decoration: const InputDecoration(labelText: 'User ID'),
),
const SizedBox(height: 16),
if (_error != null)
Text(_error!, style: const TextStyle(color: Colors.red)),
const SizedBox(height: 16),
ElevatedButton(
onPressed: _loggingIn ? null : _login,
child: _loggingIn
? const SizedBox(width: 20, height: 20, child: CircularProgressIndicator(strokeWidth: 2))
: const Text('Login'),
),
],
),
),
);
}
}
// --- Home Screen (Conversations → Messages) ---
class HomeScreen extends StatelessWidget {
final VoidCallback onLogout;
const HomeScreen({super.key, required this.onLogout});
void _logout(BuildContext context) {
CometChatUIKit.logout(
onSuccess: (_) => onLogout(),
onError: (e) => debugPrint('Logout failed: ${e.message}'),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Conversations'),
actions: [
IconButton(icon: const Icon(Icons.logout), onPressed: () => _logout(context)),
],
),
body: CometChatConversations(
onItemTap: (conversation) {
final user = conversation.conversationWith is User
? conversation.conversationWith as User : null;
final group = conversation.conversationWith is Group
? conversation.conversationWith as Group : null;
Navigator.push(context, MaterialPageRoute(
builder: (_) => MessagesScreen(user: user, group: group),
));
},
),
);
}
}
// --- Messages Screen ---
class MessagesScreen extends StatelessWidget {
final User? user;
final Group? group;
const MessagesScreen({super.key, this.user, this.group});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: CometChatMessageHeader(
user: user,
group: group,
onBack: () => Navigator.pop(context),
),
body: Column(
children: [
Expanded(child: CometChatMessageList(user: user, group: group)),
CometChatMessageComposer(user: user, group: group),
],
),
);
}
}

Key points in this scaffold:

  • CometChatUIKit.loggedInUser is checked synchronously after init() — no separate getLoggedInUser() call
  • State is managed at the MyApp level so login/logout transitions are clean
  • LoginScreen uses CometChatUIKit.login(uid) with auth key (set in UIKitSettings)
  • Logout calls CometChatUIKit.logout() and resets state

Top 10 Error Debugging

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
603
Repository forks
42
7-day trend score
31

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/cometchat/cometchat-uikit-flutter/cometchat-flutter-uikit/badge)](https://verified-skill.com/skills/cometchat/cometchat-uikit-flutter/cometchat-flutter-uikit)

Something wrong with this skill or its page? Tell us.