AI Agent Component Spec
AI Agent Component Spec
Where It Fits
CometChatMessageList is a Composite Widget that displays a list of messages and effectively manages real-time operations. It includes various types of messages such as Text Messages, Media Messages, Stickers, and more.
CometChatMessageList is primarily a list of the base widget MessageBubble. The MessageBubble Widget is utilized to create different types of chat bubbles depending on the message type.

- Dart
Minimal Render
The simplest way to renderCometChatMessageList:
- Dart
Filtering CometChatMessageList
Use themessagesRequestBuilder prop to filter which messages appear in the list.
Filter Recipes
| Recipe | Code |
|---|---|
| Limit messages | MessagesRequestBuilder()..limit = 30 |
| Search messages | MessagesRequestBuilder()..searchKeyword = "keyword" |
| Filter by type | MessagesRequestBuilder()..types = ["text"] |
| Filter by category | MessagesRequestBuilder()..categories = ["message"] |
- Dart
The following parameters in messageRequestBuilder will always be altered inside the message list:
- UID
- GUID
- types
- categories
Actions and Events
Callback Props
Component-level callbacks that fire on specific user interactions:| Callback | Signature | Fires When |
|---|---|---|
onThreadRepliesClick | void Function(BaseMessage, BuildContext, {CometChatMessageTemplate?})? | User clicks on thread indicator |
onError | OnError? | An error occurs while fetching messages |
onLoad | OnLoad<BaseMessage>? | List is successfully fetched and loaded |
onEmpty | OnEmpty? | List is empty |
onReactionClick | Function(String?, BaseMessage)? | User clicks on a reaction pill |
onReactionLongPress | Function(String?, BaseMessage)? | User long presses on a reaction pill |
onReactionListItemClick | Function(String?, BaseMessage?)? | User clicks on a reaction list item |
addMoreReactionTap | Function(BaseMessage)? | User clicks “Add More Reactions” button |
- Dart
SDK Events (Real-Time, Automatic)
The component automatically handles these SDK listeners for real-time updates:| SDK Listener | Handled Automatically |
|---|---|
onMessageReceived | Adds new message to the list |
onMessageEdited | Updates edited message in the list |
onMessageDeleted | Removes deleted message from the list |
onTypingStarted | Shows typing indicator |
onTypingEnded | Hides typing indicator |
Custom View Slots
Customize the appearance ofCometChatMessageList by replacing default views with your own widgets.
| Slot | Signature | Replaces |
|---|---|---|
loadingStateView | WidgetBuilder? | Loading spinner |
emptyStateView | WidgetBuilder? | Empty state display |
errorStateView | WidgetBuilder? | Error state display |
headerView | Widget? Function(BuildContext, {User?, Group?, int?})? | Header section |
footerView | Widget? Function(BuildContext, {User?, Group?, int?})? | Footer section |
emptyChatGreetingView | WidgetBuilder? | Empty chat greeting for AI |
newMessageIndicatorView | WidgetBuilder? | New message indicator |
Example: Custom Header View
- Dart

Example: Custom Footer View
- Dart

Example: Custom Loading State View
- Dart
Example: Custom Empty State View
- Dart
Example: Custom Error State View
- Dart
Styling
Customize the appearance ofCometChatMessageList using CometChatMessageListStyle.
Style Properties
| Property | Type | Description |
|---|---|---|
backgroundColor | Color? | Background color of the message list |
border | BoxBorder? | Border of the message list |
borderRadius | BorderRadiusGeometry? | Border radius of the message list |
avatarStyle | CometChatAvatarStyle? | Style for avatar in message bubble |
emptyStateTextStyle | TextStyle? | Style for empty state text |
emptyStateTextColor | Color? | Color for empty state text |
emptyStateSubtitleStyle | TextStyle? | Style for empty state subtitle |
emptyStateSubtitleColor | Color? | Color for empty state subtitle |
errorStateTextStyle | TextStyle? | Style for error state text |
errorStateTextColor | Color? | Color for error state text |
errorStateSubtitleStyle | TextStyle? | Style for error state subtitle |
errorStateSubtitleColor | Color? | Color for error state subtitle |
incomingMessageBubbleStyle | CometChatIncomingMessageBubbleStyle? | Style for incoming message bubble |
outgoingMessageBubbleStyle | CometChatOutgoingMessageBubbleStyle? | Style for outgoing message bubble |
messageInformationStyle | CometChatMessageInformationStyle? | Style for message information |
messageOptionSheetStyle | CometChatMessageOptionSheetStyle? | Style for message option sheet |
mentionsStyle | CometChatMentionsStyle? | Style for mentions |
actionBubbleStyle | CometChatActionBubbleStyle? | Style for group action bubbles |
reactionListStyle | CometChatReactionListStyle? | Style for reaction list |
reactionsStyle | CometChatReactionsStyle? | Style for reactions |
aiSmartRepliesStyle | CometChatAISmartRepliesStyle? | Style for smart replies |
aiConversationStarterStyle | CometChatAIConversationStarterStyle? | Style for conversation starter |
aiConversationSummaryStyle | CometChatAIConversationSummaryStyle? | Style for conversation summary |
aiAssistantSuggestedMessageTextStyle | TextStyle? | Text style for AI suggested messages |
aiAssistantSuggestedMessageTextColor | Color? | Text color for AI suggested messages |
aiAssistantSuggestedMessageBorder | Border? | Border for AI suggested messages |
aiAssistantSuggestedMessageBorderRadius | BorderRadius? | Border radius for AI suggested messages |
aiAssistantSuggestedMessageBackgroundColor | Color? | Background color for AI suggested messages |
aiAssistantSuggestedMessageIconColor | Color? | Icon color for AI suggested messages |
emptyChatGreetingTitleTextColor | Color? | Text color for empty chat greeting title |
emptyChatGreetingTitleTextStyle | TextStyle? | Text style for empty chat greeting title |
emptyChatGreetingSubtitleTextColor | Color? | Text color for empty chat greeting subtitle |
emptyChatGreetingSubtitleTextStyle | TextStyle? | Text style for empty chat greeting subtitle |
flagMessageStyle | CometchatFlagMessageStyle? | Style for flag message dialog |
newMessageIndicatorStyle | CometChatNewMessageIndicatorStyle? | Style for new message indicator |
Example: Custom Styling
- Dart

Example: Custom Avatar Style
- Dart
Example: Custom Mentions Style
- Dart

Advanced
Message Templates
CometChatMessageTemplate is a pre-defined structure for creating message views that can be used as a starting point or blueprint for creating message bubbles.- Dart
- Android
- iOS

Date Separator Pattern
Customize the date separator pattern:- Dart
- Android
- iOS

Date Pattern
Customize the date pattern for message receipts:- Dart
- Android
- iOS

Props Reference
| Prop | Type | Default | Description |
|---|---|---|---|
user | User? | null | User object for user message list |
group | Group? | null | Group object for group message list |
messagesRequestBuilder | MessagesRequestBuilder? | null | Custom request builder for filtering |
style | CometChatMessageListStyle? | - | Sets style for message list |
scrollController | ScrollController? | - | Controller for the message list |
emptyStateText | String? | - | Text when list is empty |
errorStateText | String? | - | Text when error occurs |
loadingStateView | WidgetBuilder? | - | View for loading state |
emptyStateView | WidgetBuilder? | - | View for empty state |
errorStateView | WidgetBuilder? | - | View for error state |
disableSoundForMessages | bool? | null | Disables sound for messages |
customSoundForMessages | String? | null | Custom sound URL |
readIcon | Widget? | - | Custom read icon |
deliveredIcon | Widget? | - | Custom delivered icon |
sentIcon | Widget? | - | Custom sent icon |
waitIcon | Widget? | - | Custom wait icon |
alignment | ChatAlignment | standard | Chat alignment setting |
avatarVisibility | bool? | true | Toggle avatar visibility |
datePattern | String Function(BaseMessage)? | - | Custom date pattern |
hideTimestamp | bool? | null | Toggle timestamp visibility |
templates | List<CometChatMessageTemplate>? | - | Message templates |
onThreadRepliesClick | ThreadRepliesClick? | - | Thread replies callback |
headerView | Widget? Function(...)? | - | Custom header view |
footerView | Widget? Function(...)? | - | Custom footer view |
dateSeparatorPattern | String Function(DateTime)? | - | Date separator pattern |
onError | OnError? | - | Error callback |
receiptsVisibility | bool? | true | Toggle read receipts |
dateSeparatorStyle | CometChatDateStyle? | - | Date separator style |
disableReactions | bool? | false | Toggle reactions |
addReactionIcon | Widget? | - | Custom add reaction icon |
favoriteReactions | List<String>? | - | Frequently used reactions |
textFormatters | List<CometChatTextFormatter>? | - | Text formatters |
disableMentions | bool? | null | Disable mentions |
padding | EdgeInsetsGeometry? | - | Padding for message list |
margin | EdgeInsetsGeometry? | - | Margin for message list |
width | double? | - | Width of message list |
height | double? | - | Height of message list |
onLoad | OnLoad<BaseMessage>? | - | Load callback |
onEmpty | OnEmpty? | - | Empty callback |
onReactionClick | Function(String?, BaseMessage)? | - | Reaction click callback |
onReactionLongPress | Function(String?, BaseMessage)? | - | Reaction long press callback |
hideStickyDate | bool? | false | Hide sticky date |
hideReplyInThreadOption | bool? | false | Hide reply in thread option |
hideTranslateMessageOption | bool? | false | Hide translate option |
hideEditMessageOption | bool? | false | Hide edit option |
hideDeleteMessageOption | bool? | false | Hide delete option |
hideReactionOption | bool? | false | Hide reaction option |
hideMessagePrivatelyOption | bool? | false | Hide message privately option |
hideCopyMessageOption | bool? | false | Hide copy option |
hideMessageInfoOption | bool? | false | Hide message info option |
hideGroupActionMessages | bool? | false | Hide group action messages |
enableConversationStarters | bool? | false | Enable conversation starters |
enableSmartReplies | bool? | false | Enable smart replies |
hideShareMessageOption | bool? | false | Hide share option |
smartRepliesDelayDuration | int? | 10000 | Smart replies delay (ms) |
smartRepliesKeywords | List<String>? | - | Smart replies keywords |
addTemplate | List<CometChatMessageTemplate>? | - | Add custom templates |
dateTimeFormatterCallback | DateTimeFormatterCallback? | - | Date time formatter |
hideModerationView | bool? | null | Hide moderation view |
hideThreadView | bool? | null | Hide thread view |
suggestedMessages | List<String>? | - | AI assistant suggestions |
hideSuggestedMessages | bool? | false | Hide suggested messages |
emptyChatGreetingView | WidgetBuilder? | - | Empty chat greeting view |
setAiAssistantTools | Map<String, Function(String?)>? | - | AI assistant tools |
streamingSpeed | int? | - | AI streaming speed |
hideDateSeparator | bool? | false | Hide date separator |
mentionAllLabel | String? | - | Group mention label |
mentionAllLabelId | String? | - | Group mention label ID |
hideFlagOption | bool? | false | Hide report option |
hideFlagRemarkField | bool? | false | Hide flag remark field |
startFromUnreadMessages | bool? | false | Start from unread messages |
showMarkAsUnreadOption | bool? | false | Show mark as unread option |
newMessageIndicatorView | WidgetBuilder? | - | New message indicator view |
enableConversationSummary | bool? | false | Enable conversation summary |
generateConversationSummary | bool? | false | Generate conversation summary |
hideReplyOption | bool? | false | Hide reply option |
flagReasonLocalizer | String Function(String)? | - | Flag reason localizer |
reactionsRequestBuilder | ReactionsRequestBuilder? | - | Request builder for reactions |
stateCallBack | Function(CometChatMessageListController)? | - | Callback to access controller |
customSoundForMessagePackage | String? | - | Package name for custom sound |
messageId | int? | - | Specific message ID to scroll to |
Message Header
Display user or group details in the header
Message Composer
Compose and send messages
Message Template
Customize message bubble templates
Theming
Learn how to customize the look and feel


