AI Integration Quick Reference
AI Integration Quick Reference
OfflineConfig to your AppSettings. Until you do, the SDK behaves exactly as before. This page covers the minimal setup; for every tunable option see the Configuration & API Reference.
1
Requirements
Offline support requires CometChat Flutter SDK 5.1.0 or later. Add or update the dependency in your Then run
pubspec.yaml:flutter pub get. This release needs Dart 3.10+, Flutter 3.38+, iOS 13+, and Android minSdk 21.If you are new to the SDK, complete the standard setup first; the steps below only add offline configuration to your existing init.2
Build an OfflineConfig
Construct an
OfflineConfig and set enabled: true. Every other field has a sensible default, so set only what you need.- Dart
3
Attach it to AppSettings
Pass the config to
AppSettingsBuilder.setOfflineConfig(...). To enable with all defaults instead of building a config, use the offline(bool) shorthand.- Dart
If you call both
setOfflineConfig(...) and offline(bool), the explicit OfflineConfig wins — its enabled value is authoritative.4
Initialize the SDK
Pass the settings to
CometChat.init(...) as you do today. No other call changes.- Dart
5
Verify it is active
Call
CometChat.isOfflineEnabled(). It returns true only while offline support is actually active for the logged-in user. It is false before anyone logs in (even when you enabled it in AppSettings), after logout or session expiry, and when the encrypted cache cannot open. Read it at the moment of each decision and keep no copy of the result.- Dart