cometchat_sdk 5.1.0
cometchat_sdk: ^5.1.0 copied to clipboard
CometChat enables you to add voice, video & text chat for your website & app. This guide demonstrates how to add chat to an Flutter application using CometChat.
CometChat SDK for Flutter #
The CometChat SDK is a robust toolkit that developers can utilize to swiftly incorporate a reliable and fully-featured chat functionality into an existing or new application. It removes the complexity of building a chat infrastructure from scratch, thus accelerating the development process and reducing time to market.
Prerequisites #
- Flutter >=3.38
- Dart >=3.10
- Android Studio 2022.2
- Android 5.0, API 21 and above
- Xcode 15
- iOS 13.0
- Network access to github.com at build time: the SDK depends on the
sqlite3package, whose build hook downloads a prebuilt SQLite binary from GitHub.
Getting Started #
To set up Flutter SDK and utilize CometChat for your chat and calls functionality, you'll need to follow these steps:
- Register at the CometChat Dashboard to create an account.
- After registering, log into your CometChat account and create a new app. Once created, CometChat will generate an Auth Key and App ID for you. Keep these credentials secure as you'll need them later.
- Check the key concepts to understand the basic components of CometChat.
- Refer to the Integration Steps in our documentation to integrate the SDK into your Flutter app.
Offline messaging #
The SDK can keep a local copy of your conversations and messages so the app keeps working without a network connection. It is off by default; enable it in AppSettings:
final appSettings = AppSettingsBuilder()
.setRegion(region)
.setOfflineConfig(const OfflineConfig(enabled: true))
.build();
await CometChat.init(appId, appSettings);
Web. After flutter pub get, run this once from your app's root directory to copy the required WebAssembly files into web/ (native and desktop builds need nothing extra):
dart run cometchat_sdk:setup_web
Re-run it whenever you change the drift or sqlite3 versions your app resolves.
Encryption (optional). To encrypt the local cache at rest, set encryption: true on OfflineConfig and add this build-hook stanza to your own app's pubspec.yaml — it has no effect inside the SDK's pubspec:
hooks:
user_defines:
sqlite3:
source: sqlite3mc
On web, also copy the SDK's cipher-enabled build into your web root:
cp <pub-cache>/cometchat_sdk/lib/assets/web/sqlite3mc.wasm web/sqlite3mc.wasm
See the CometChat documentation for the full offline guide.
Help and Support #
For issues running the project or integrating with our SDK, consult our documentation or create a support ticket or seek real-time support via the CometChat Dashboard.