CometChatConversations renders a scrollable list of recent conversations with real-time updates for new messages, typing indicators, read receipts, and user presence.
Where It Fits
CometChatConversations is a list component. It renders recent conversations and emits the selected Conversation via onItemTap. Wire it to CometChatMessageHeader, CometChatMessageList, and CometChatMessageComposer to build a standard chat layout.
- Dart
Quick Start
Using Navigator:- Dart
- Dart
CometChatUIKit.init(), a user logged in, and the UI Kit dependency added.
Filtering Conversations
Pass aConversationsRequestBuilder to control what loads:
- Dart
Filter Recipes
Actions and Events
Callback Methods
onItemTap
Fires when a conversation row is tapped. Primary navigation hook.
- Dart
onItemLongPress
Fires when a conversation row is long-pressed. By default shows a delete overlay (when deleteConversationOptionVisibility is true).
- Dart
onBack
Fires when the user presses the back button in the app bar.
- Dart
onSelection
Fires when conversations are selected/deselected in multi-select mode.
- Dart
onError
Fires on internal errors (network failure, auth issue, SDK exception).
- Dart
onLoad
Fires when the list is successfully fetched and loaded.
- Dart
onEmpty
Fires when the list is empty after loading.
- Dart
Global Events
The component emits events viaCometChatConversationEvents that can be subscribed to from anywhere:
- Dart
SDK Events (Real-Time, Automatic)
The component listens to these SDK events internally. No manual setup needed.Functionality
Custom View Slots
Leading View
Replace the avatar / left section.- Dart
Title View
Replace the name / title text.- Dart
Subtitle View
Replace the last message preview.- Dart
Trailing View
Replace the timestamp / badge / right section.- Dart
List Item View
Replace the entire list item row.- Dart
State Views
- Dart
Menu Options
- Dart
Common Patterns
Minimal list — hide all chrome
- Dart
Users-only conversations
- Dart
Custom date formatting
- Dart
Advanced
BLoC Access
Provide a customConversationsBloc to override behavior:
- Dart
Extending ConversationsBloc
ConversationsBloc uses the ListBase<Conversation> mixin with override hooks for custom list behavior:
- Dart
ListBase override hooks (onItemAdded, onItemRemoved, onItemUpdated, onListCleared, onListReplaced), see BLoC & Data — ListBase Hooks.
Public BLoC Events
Public BLoC Methods
Route Observer
Pass aRouteObserver to freeze rebuilds when another screen is pushed on top (prevents expensive rebuilds during keyboard animation):
- Dart
Style
- Dart
Style Properties
See Component Styling for the full reference.
Next Steps
Users
Browse and search available users
Message List
Display messages for a conversation
Component Styling
Detailed styling reference
Message Template
Customize message bubble structure