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
Multiple Attachments
A media message carrying several attachments renders with a dedicated per-type bubble: a media grid for images and videos, inline player rows for audio files, and a connected card stack for documents.
Tapping any image/video cell opens the full-screen media viewer, paged across the message’s image, video and audio attachments.
A voice note always renders as the classic single audio bubble, whatever the flag below — it is single by nature. Only picked audio files use the multi-attachment bubble.
image message and a file message: the photos render as a grid, the PDF as a card. They share a batchId and group as described below.
Grouping
Messages produced by one send sharebatchId, batchIndex and batchSize metadata, and the list presents them as one block:
- the avatar and sender name appear on the first message only
- the timestamp and receipt appear on the last message only
- reactions stay attached to their individual message
- the caption rides on the last message of the batch
Enable or disable
- Dart
false to render the classic single-attachment bubbles (CometChatImageBubble, CometChatVideoBubble, CometChatAudioBubble, CometChatFileBubble) instead. Those bubbles are deprecated and remain only for that path.
You can also drive it per-template through AdditionalConfigurations:
- Dart
Styling
Each bubble has its own style class:
Where a property has an equivalent on the old singular bubble it keeps the same name (
playIconColor, titleTextStyle, backgroundColor…), so migrating is a rename of the class, not of every field. Grid-only knobs — tileBorderRadius, gridSpacing, overflowScrimColor, captionTextStyle, the duration chip and the “+N more” toggle — have no old counterpart.
- 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