Skip to main content
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.

Quick Start

Using Navigator:
Embedding as a widget:
Prerequisites: CometChat SDK initialized with CometChatUIKit.init(), a user logged in, and the UI Kit dependency added.
Simply adding the MessageList component to the layout will only display the loading indicator. You must supply a User or Group object to fetch messages.

Filtering

Pass a MessagesRequestBuilder to control what loads:
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.

onError

Fires on internal errors.

onLoad

Fires when the list is successfully fetched and loaded.

onEmpty

Fires when the list is empty after loading.

onReactionClick

Fires when a reaction pill is tapped.

onReactionLongPress

Fires when a reaction pill is long-pressed.

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.
Custom view displayed at the bottom of the message list.

State Views

Text Formatters (Mentions)

Message Templates

Override or extend message bubble rendering:
See Message Template for the full template structure.

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.
A message always carries attachments of a single kind, so each one renders with the bubble for that kind. Picking a mix — say three photos and a PDF — sends an 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 share batchId, 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
Deleting one message of a batch takes it out of the group: it renders as a standalone delete bubble, and its neighbours treat it as a batch boundary.

Enable or disable

Set it to 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:

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.
These bubbles are styled only through theme extensions. The per-message-list slots — AdditionalConfigurations.imageBubbleStyle and CometChatIncoming/OutgoingMessageBubbleStyle.imageBubbleStyle — still target the deprecated singular bubbles and are ignored while enableMultipleAttachments is true. Move that styling into the theme.
To stage and send multiple attachments, see Message Composer.

Message Option Visibility


Common Patterns

Thread replies view

Jump to a specific message

Start from unread messages

Load last agent conversation

Resume the most recent AI agent conversation on start:

Flag / Report a message

Flag/report is available by default from the message long-press menu. Toggle its visibility and customize the dialog:

Mark a message as unread

Expose the “Mark as Unread” option in the long-press menu:

Advanced

BLoC Access

Provide a custom MessageListBloc to override behavior:

Extending MessageListBloc

MessageListBloc uses the ListBase<BaseMessage> mixin with override hooks:
For 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 an operationsStream consumed by CometChatAnimatedMessageList for smooth animations:

Style

See Component Styling and Message Bubble Styling for the full reference.

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