Skip to main content
# pubspec.yaml
dependencies:
  cometchat_sdk: ^4.0.33
import 'package:cometchat_sdk/cometchat_sdk.dart';
Key Points:
  • Add cometchat_sdk to your pubspec.yaml and run flutter pub get
  • iOS: Update Podfile with simulator architecture exclusions, set deployment target to 11+, disable Bitcode
  • Android: Requires API Level 21+, AndroidX compatibility
  • Import package:cometchat_sdk/cometchat_sdk.dart wherever you need the SDK

Add the CometChat Dependency

Add the CometChat SDK to your pubspec.yaml file:
dependencies:
  cometchat_sdk: ^4.0.33
Then run:
flutter pub get

Platform Configuration

iOS

  1. Add the following to your Podfile inside the iOS section of your app:
post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |build_configuration|
      build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64 i386'
    end
  end
end
  1. Set the deployment target to 11 or higher.
  2. Navigate to your iOS folder in terminal and run pod install. For Apple Silicon systems, use a Rosetta terminal.
  3. In Xcode, set Enable Bitcode to No in your project’s Build Settings.

Android

  • Minimum API Level: 21
  • AndroidX compatibility is required
No additional configuration is needed for Android beyond ensuring these requirements are met.

Import the SDK

Import the CometChat SDK in your Dart files:
import 'package:cometchat_sdk/cometchat_sdk.dart';

Get Your Credentials

Before initializing the SDK, get your credentials from the CometChat Dashboard:
  1. Sign up or log in
  2. Create a new app (or use an existing one)
  3. Go to API & Auth Keys and note your:
    • App ID
    • Region
    • Auth Key
Auth Key is for development and testing only. In production, generate Auth Tokens on your server using the REST API. Never expose Auth Keys in production client code.

Next Steps

Setup & Initialization

Configure and initialize the SDK in your Flutter app

Authentication

Learn how to authenticate users with Auth Keys and Auth Tokens