CometChatMessageList renders a scrollable list of messages for a conversation with real-time updates for new messages, edits, deletions, reactions, and threaded replies.
Where It Fits
CometChatMessageList is a message display component. It requires either a User or Group object to fetch and render messages. Wire it with CometChatMessageHeader and CometChatMessageComposer to build a complete messaging layout.
- Dart
Quick Start
Using Navigator:- Dart
- Dart
CometChatUIKit.init(), a user logged in, and the UI Kit dependency added.
Filtering
Pass aMessagesRequestBuilder to control what loads:
- Dart
The following parameters in
MessagesRequestBuilder will always be altered inside the message list: UID, GUID, types, categories.Actions and Events
Callback Methods
onThreadRepliesClick
Fires when a user taps a threaded message bubble.
- Dart
onError
Fires on internal errors.
- Dart
onLoad
Fires when the list is successfully fetched and loaded.
- Dart
onEmpty
Fires when the list is empty after loading.
- Dart
onReactionClick
Fires when a reaction pill is tapped.
- Dart
onReactionLongPress
Fires when a reaction pill is long-pressed.
- Dart
SDK Events (Real-Time, Automatic)
The component listens to SDK message events internally. No manual setup needed.Functionality
* One of
user or group is required.
Custom View Slots
Header View
Custom view displayed at the top of the message list.- Dart
Footer View
Custom view displayed at the bottom of the message list.- Dart
State Views
- Dart
Text Formatters (Mentions)
- Dart
Message Templates
Override or extend message bubble rendering:- Dart
Message Option Visibility
Common Patterns
Thread replies view
- Dart
Jump to a specific message
- Dart
Start from unread messages
- Dart
Load last agent conversation
Resume the most recent AI agent conversation on start:- Dart
Flag / Report a message
Flag/report is available by default from the message long-press menu. Toggle its visibility and customize the dialog:- Dart
Mark a message as unread
Expose the “Mark as Unread” option in the long-press menu:- Dart
Advanced
BLoC Access
Provide a customMessageListBloc to override behavior:
- Dart
Extending MessageListBloc
MessageListBloc uses the ListBase<BaseMessage> mixin with override hooks:
- Dart
ListBase override hooks (onItemAdded, onItemRemoved, onItemUpdated, onListCleared, onListReplaced), see BLoC & Data — ListBase Hooks.
Public BLoC Events
Public BLoC Methods
O(1) Lookup Methods
ValueNotifier Accessors (Isolated Rebuilds)
MessageReceiptStatus Enum
Operations Stream
The BLoC exposes anoperationsStream consumed by CometChatAnimatedMessageList for smooth animations:
Style
- Dart
Next Steps
Message Header
Display user/group info in the app bar
Message Composer
Rich input for sending messages
Message Template
Customize message bubble structure
Component Styling
Detailed styling reference