chat_ui/src/message_list/message_list library

Barrel export for message_list module

This module provides the CometChatMessageList component with Clean Architecture.

Architecture

  • BLoC for state management (flutter_bloc)
  • Repository pattern for data access
  • Use cases for business logic
  • Service locator for dependency injection

Usage

CometChatMessageList(
  user: targetUser,
  messageItemBuilder: (context, message, index, animation) {
    return MessageBubble(message: message);
  },
)

Classes

AddReaction
Add a reaction to a message
AnimatedMessageListBloc
BLoC for managing animated message list state
AnimatedMessageListState
State for the animated message list BLoC (legacy compatibility)
CometChatAnimatedMessageList
An animated list widget for displaying chat messages
CometChatMessageActionOverlay
A full-screen overlay that displays message actions in a modern context menu style.
CometChatMessageActionOverlayStyle
Style class for CometChatMessageActionOverlay
CometChatMessageList
CometChatMessageList is a Clean Architecture + BLoC based message list widget.
CometChatMessageListStyle
CometChatMessageListStyle is a data class that has styling-related properties to customize the appearance of CometChatMessageList
CometchatMessageOptionSheet
CometchatMessageOptionSheet renders a bottom modal sheet that contains all the actions available to execute on a particular type of message
CometChatMessageSwipe
A widget that wraps a message bubble and enables swipe-to-reply gesture.
DeliveryReceiptReceived
Handle delivery receipt from SDK listener
EmptyMessageList
Empty state widget shown when there are no messages
ForceEmptyState
Force the message list into empty state without loading messages. Used for AI users with no active thread (fresh chat).
GetLoggedInUserUseCase
Use case for getting the currently logged-in user.
GetMessagesResult
Result class containing both the MessagesRequest and fetched messages.
GetMessagesUseCase
Use case for getting messages for a conversation.
InsertAllMessages
Insert multiple messages into the list
InsertMessage
Insert a single message into the list
JumpToMessage
Jump to a specific message by ID
LoadFromUnread
Load messages starting from unread position
LoadMessages
Load initial messages for a conversation
LoadMoreIndicator
A loading indicator shown during pagination
LoadNewerMessages
Load newer messages (pagination - scroll down)
LoadNewerMessagesUseCase
Use case for loading newer messages for pagination (scroll down).
LoadOlderMessages
Load older messages (pagination - scroll up)
LoadOlderMessagesUseCase
Use case for loading older messages for pagination (scroll up).
MarkAsDeliveredUseCase
Use case for marking a message as delivered.
MarkAsReadUseCase
Use case for marking a message as read.
MarkAsUnreadUseCase
Use case for marking a message as unread.
MarkMessageAsRead
Mark a message as read
MarkMessageAsUnread
Mark a message as unread
MessageDeleted
Handle message deletion from SDK listener
MessageEdited
Handle message edit from SDK listener
MessageListBloc
BLoC for managing message list state with Clean Architecture
MessageListBlocAdapter
Adapter that wraps MessageListBloc to implement CometChatMessageListControllerProtocol.
MessageListEvent
Base class for all message list events Uses Equatable for proper event comparison in BLoC
MessageListLocalDataSource
Abstract interface for message list local data source.
MessageListLocalDataSourceImpl
Implementation of MessageListLocalDataSource using in-memory cache.
MessageListRemoteDataSource
Abstract interface for message list remote data source.
MessageListRemoteDataSourceImpl
Implementation of MessageListRemoteDataSource using CometChat SDK.
MessageListRepository
Repository interface for message list data operations.
MessageListRepositoryImpl
Implementation of MessageListRepository.
MessageListServiceLocator
Service Locator for Message List module.
MessageListState
State for the message list BLoC (Clean Architecture)
MessageReceived
Handle incoming message from SDK listener
MessageSentByUser
Handle message sent by the logged-in user (from UI events)
ReactionAddedFromSDK
Handle reaction added from SDK listener
ReactionRemovedFromSDK
Handle reaction removed from SDK listener
ReadReceiptReceived
Handle read receipt from SDK listener
RefreshMessages
Refresh the message list
RemoveMessage
Remove a message from the list
RemoveReaction
Remove a reaction from a message
ResetUnreadState
Reset unread state
ScrollToBottomButton
A floating action button that appears when the user scrolls away from the bottom
SetActiveConversation
Set active conversation (for unread count management)
SetHasMoreNewer
Set whether there are more newer messages to load
SetHasMoreOlder
Set whether there are more older messages to load
SetLoadingNewer
Set the loading newer messages state
SetLoadingOlder
Set the loading older messages state
SetMessages
Replace the entire message list
SliverSpacing
A sliver that provides dynamic spacing at the bottom of the message list
SyncMessages
Silently sync messages missed while app was in background or disconnected
UpdateMessage
Update an existing message in the list

Enums

InitialScrollToEndMode
Enum controlling the initial scroll behavior of the message list
MessageListStatus
Status enum for message list
MessageReceiptStatus
Enum representing message receipt status for ValueNotifier updates

Functions

showMessageActionOverlay({required BuildContext context, required BaseMessage message, required Widget bubbleWidget, required List<ActionItem> actionItems, required BubbleAlignment bubbleAlignment, String? heroTag, Size? bubbleSize, List<String>? favoriteReactions, dynamic onReactionTap(BaseMessage message, String reaction)?, dynamic onAddReactionTap(BaseMessage message)?, Widget? addReactionIcon, bool hideReactions = false, CometChatMessageActionOverlayStyle? style}) Future<ActionItem?>
Shows the message action overlay as a full-screen dialog.
showMessageOptionSheet({required BuildContext context, required List<ActionItem> actionItems, required CometChatColorPalette colorPalette, String? title, required dynamic message, CometChatMessageListControllerProtocol? state, CometChatMessageListControllerProtocol? controllerProtocol, dynamic onReactionTap(BaseMessage message, String? reaction)?, Widget? addReactionIcon, dynamic addReactionIconTap(BaseMessage message)?, bool hideReactions = false, List<String>? favoriteReactions, CometChatMessageOptionSheetStyle? style, bool? hideReactionOption}) Future<ActionItem?>
Function to show message option bottom sheet

Typedefs

EmptyMessageListBuilder = Widget Function(BuildContext context)
Builder type for custom empty state widget
HeaderFooterBuilder = Widget? Function(BuildContext context, {Group? group, int? parentMessageId, User? user})
Builder function for header and footer views
LoadMoreBuilder = Widget Function(BuildContext context)
Builder type for custom load more indicator
MessageItemBuilder = Widget Function(BuildContext context, BaseMessage message, int index, Animation<double> animation)
Builder function for message items with animation support
ScrollToBottomBuilder = Widget Function(BuildContext context, Animation<double> animation, VoidCallback onPressed)
Builder type for custom scroll-to-bottom button
ScrollToIndexCallback = Future<bool> Function(int index, {double alignment, Duration duration})
Callback type for scrolling to a specific index Returns true if the scroll was initiated, false if the list wasn't ready
ScrollToMessageCallback = Future<bool> Function(int messageId, {double alignment, Duration duration})
Callback type for scrolling to a specific message by ID Returns true if the scroll was initiated, false if the list wasn't ready
StateViewBuilder = Widget Function(BuildContext context)
Builder function for state views (empty, error, loading)
ThreadRepliesClick = void Function(BaseMessage message, BuildContext context, {CometChatMessageTemplate? template})
Callback for thread replies click

Exceptions / Errors

MessageListLocalDataSourceException
Exception thrown when local data source operations fail.
MessageListRemoteDataSourceException
Exception thrown when remote data source operations fail.