Documentation Index
Fetch the complete documentation index at: https://www.cometchat.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
AI Integration Quick Reference
AI Integration Quick Reference
Prerequisites
| Requirement | Version |
|---|---|
| Flutter SDK | 1.2 or higher |
| Android API Level | 21 or higher |
| AndroidX | Required |
| iOS | 11 or higher |
- Create a new app
- Head over to the API & Auth Keys section and note the Auth Key, App ID & Region
Installation
Add the following dependency to yourpubspec.yaml file and run pub get:
- Dart
iOS Setup
- Add the following to your Podfile inside the iOS section of your app:
- Ruby
- Change the deployment target to
11or higher. - Navigate to your iOS folder in terminal and run
pod install. For Apple Silicon systems, use a Rosetta terminal. - Set Enabled Bitcode to NO in the Build Settings of your Xcode project.

Import the SDK
- Dart
Initialization
Theinit() method initializes the SDK and must be called before any other CometChat method. Call it once at app startup, typically in your root widget’s initState() or main() function.
- Dart
APP_ID and APP_REGION with your credentials from the Dashboard.
Parameters
| Parameter | Type | Description |
|---|---|---|
appId | String | Your CometChat App ID |
appSettings | AppSettings | Configuration object built with AppSettingsBuilder |
onSuccess | Function(String) | Callback triggered on successful initialization |
onError | Function(CometChatException) | Callback triggered on initialization failure |
AppSettings Options
| Property | Type | Description | Default |
|---|---|---|---|
subscriptionType | String? | Presence subscription type (CometChatSubscriptionType.allUsers, .roles, .friends) | — |
roles | List<String>? | Roles to subscribe to when using role-based presence | — |
region | String? | Region where your app was created (us, eu, in) | Required |
autoEstablishSocketConnection | bool | Let SDK manage WebSocket connections automatically | true |
adminHost | String? | Custom admin URL (dedicated deployment) | — |
clientHost | String? | Custom client URL (dedicated deployment) | — |
Presence Subscription
Choose how to subscribe to user presence (online/offline status):Response
Response
On Success — A
String message confirming SDK initialization:| Parameter | Type | Description | Sample Value |
|---|---|---|---|
message | String | Success confirmation message | "Initialization completed successfully" |
Error
Error
| Parameter | Type | Description | Sample Value |
|---|---|---|---|
code | String | Error code identifier | "ERR_CHAT_API_FAILURE" |
message | String | Human-readable error message | "SDK initialization failed." |
details | String | Additional technical details | "Please verify your App ID and region, then try again." |
WebSocket Connection
By default, the SDK manages WebSocket connections automatically. To manage them manually:Next Steps
Authentication
Log in users with Auth Key or Auth Token
Send Messages
Send your first message