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 sqlite3 package, 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.

Libraries

ai
CometChat SDK — AI sub-package.
builders/app_settings_request
builders/banned_group_member_request
builders/blocked_users_request
builders/conversations_request
builders/group_members_request
builders/groups_request
builders/messages_request
builders/notification_categories_request
builders/notification_feed_request
builders/reaction_request
builders/threads_request
builders/users_request
calling
CometChat SDK — Calling sub-package.
cometchat_sdk
core
CometChat SDK — Core sub-package.
exception/cometchat_exception
handlers/ai_assistant_listener
handlers/banned_group_member_fetch_listener
handlers/blocked_users_fetch_listener
handlers/call_listener
handlers/connection_listener
handlers/conversation_details_listener
handlers/conversation_fetch_listener
handlers/conversation_listener
handlers/event_handler
handlers/group_fetch_listener
handlers/group_listener
handlers/group_member_fetch_listener
handlers/login_listener
handlers/media_download_listener
handlers/message_details_listener
handlers/message_fetch_listener
handlers/message_listener
handlers/message_sent_listener
handlers/notification_feed_fetch_listener
handlers/notification_feed_listener
handlers/offline_cache_reset_listener
handlers/offline_message_listener
handlers/reaction_fetch_listener
handlers/sync_listener
handlers/threads_fetch_listener
handlers/upload_file_listener
handlers/user_fetch_listener
handlers/user_listener
helpers/cometchat_helper
main/cometchat
messaging
CometChat SDK — Messaging sub-package.
models
CometChat SDK — Domain Models sub-package.
models/action
models/ai/ai_assistant_base_event
models/ai/ai_assistant_content_received_event
models/ai/ai_assistant_message
models/ai/ai_assistant_message_ended_event
models/ai/ai_assistant_run_finished_event
models/ai/ai_assistant_run_started_event
models/ai/ai_assistant_tool_argument_event
models/ai/ai_assistant_tool_ended_event
models/ai/ai_assistant_tool_event_result
models/ai/ai_assistant_tool_started_event
models/ai/ai_tool_argument_message
models/ai/ai_tool_call
models/ai/ai_tool_call_function
models/ai/ai_tool_result_message
models/app_entity
models/attachment
models/base_message
models/call
models/conversation
models/conversation_update_settings
models/custom_message
models/flag_detail
models/flag_reason
models/group
models/group_member
models/interaction
models/interaction_goal
models/interaction_receipt
models/interactive_message
models/media_message
models/message_receipt
models/reaction
models/reaction_count
models/text_message
models/transient_message
models/typing_indicator
models/user
moderation
CometChat SDK — Moderation sub-package.
notification/constants/cometchat_notification_constant
notification/enums/day_of_week
notification/enums/dnd_options
notification/enums/member_actions_options
notification/enums/messages_options
notification/enums/muted_conversation_type
notification/enums/push_platforms
notification/enums/quoted_replies_options
notification/enums/reactions_options
notification/enums/replies_options
notification/main/cometchat_notifications
notification/models/day_schedule
notification/models/group_preferences
notification/models/mute_preferences
notification/models/muted_conversation
notification/models/notification_preferences
notification/models/one_on_one_preferences
notification/models/push_preferences
notification/models/reaction_event
notification/models/unmuted_conversation
notifications
CometChat SDK — Notifications sub-package.
utils/constants
utils/enums/attachment_type_enum
utils/enums/moderation_status_enum
utils/enums/sort_by_order_enum