Prerequisites
Before installing the UI Kit, you need to create a CometChat application on the CometChat Dashboard, which includes all the necessary data for a chat service, such as users, groups, calls, and messages. You will require theApp ID, AuthKey, and Region of your CometChat application when initializing the SDK.
i. Register on CometChat
- You need to register on the CometChat Dashboard first. Click here to sign up.
- Create a new app
- Head over to the QuickStart or API & Auth Keys section and note the App ID, Auth Key, and Region.
Each CometChat application can be integrated with a single client app. Within the same application, users can communicate with each other across all platforms, whether they are on mobile devices or on the web.iii. Platform & IDE Setup
- Flutter installed on your system.
- Android Studio or VS Code with configured Flutter/Dart plugins.
- Xcode & Pod (CocoaPods) for iOS.
- An iOS device or emulator with iOS 13.0 or above.
- Android device or emulator with Android version 7.0 (API 24) or above.
Getting Started
Step 1: Create Flutter application project
To get started, create a new flutter application project.Step 2: Add Dependency
1. Install via CLI Since V6 is hosted on Cloudsmith (not pub.dev), run this command instead of the standardflutter pub add:
pubspec.yaml:
pubspec.yaml
pubspec.yaml
pubspec.yaml
2. Android App Setup Update the
minSdkVersion in your Android project configuration, located at android/app/build.gradle:
build.gradle
3. Update iOS Podfile In your Podfile (located at
ios/Podfile), update the minimum iOS version:
Podfile
4. Import CometChat UIKit In your Dart code, import the CometChat UIKit package:
main.dart
V6 uses a single import. The cometchat_uikit_shared package is internalized — no separate import needed.
Step 3: Initialize UI Kit
Before using any features from the CometChat UI Kit, initialize it with your app credentials.- Create a Configuration File:
cometchat_config.dart
- Initialize the UI Kit:
main.dart
V6 difference from V5: NoextensionsoraiFeatureparameters needed. Extensions are built-in and handled automatically byMessageTemplateUtils.
Step 4: Login to UI Kit
Once the UI Kit is initialized, authenticate your user using thelogin() method.
main.dart
cometchat-uid-1cometchat-uid-2cometchat-uid-3cometchat-uid-4cometchat-uid-5
For more information, refer to the documentation on Init and Login.
Example: Initialization and Login Combined
main.dart
Step 5: Choose a Chat Experience
Integrate a conversation view that suits your application’s UX requirements. Below are the available options:1. Conversation List + Message View
Best for: Flutter apps that need a smooth, stack-based navigation between conversations and messages. Highlights:- Compact Layout – Uses
Navigator.push()for mobile-first navigation. - One-to-One & Group Chats – Built-in support for private and group conversations.
- Real-Time Messaging – Message list auto-refreshes with CometChat events.
- BLoC-Powered – Predictable state management with
ConversationsBlocandMessageListBloc.
- You want a clean navigation experience for multiple chat sessions.
- Your Flutter app supports both direct and group messaging.
2. One-to-One / Group Chat
Best for: When a user lands directly into a chat screen, bypassing the conversation list. In V6, you compose the chat screen using individual widgets:V6 does not have a combinedUse When:CometChatMessagescomposite widget. You compose the UI yourself usingCometChatMessageHeader,CometChatMessageList, andCometChatMessageComposer.
- Your chat starts from a specific user or group ID.
- You want a clean, focused chat interface.
- Use case involves support, onboarding, or one-time messages.
3. Tab-Based Messaging UI (All-in-One)
Best for: Flutter apps needing a multi-tab experience to access Chat, Users, Calls, and Settings. Use When:- You need a full-featured chat solution in one UI.
- Your users require structured navigation between modules.
Build Your Own Chat Experience
Best for: Developers who need complete control over their chat interface. Key Areas to Explore:- Core Features – Learn about messaging, real-time updates, and other essential capabilities.
- Components – Utilize prebuilt UI elements or customize them to fit your design.
- Themes – Adjust colors, fonts, and styles to match your branding.
Next Steps
- Integrate Conversation List + Message
- Integrate One-to-One Chat
- Integrate Tab-Based Chat
- Advanced Customizations