MessageTemplateUtils is the central registry that defines how each message type is rendered, what options appear on message bubbles, and what text formatters are applied. It replaces the DataSource / ChatConfigurator pattern used in the Android UI Kit.
How It Works
In V6,MessageTemplateUtils is a static utility class that provides:
- Message templates (how each message type is rendered as a bubble)
- Message options (long-press actions per message type)
- Text formatters (text processing for mentions, links, etc.)
- Message type/category lists (for request builder filtering)
MessageTemplateUtils internally to get defaults. You override behavior by passing custom templates, options, or formatters directly to the component.
Getting Default Templates
- Dart
Available Template Methods
Overriding Templates
Replace All Templates
Pass a complete list of templates toCometChatMessageList:
- Dart
Add or Override Specific Templates
UseaddTemplate to merge custom templates with defaults. Templates are keyed by category_type — if your template matches an existing key, it overrides the default:
- Dart
Message Options
Getting Default Options
- Dart
Option Methods by Message Type
Text Formatters
- Dart
Type and Category Lists
Used when building customMessagesRequestBuilder instances:
- Dart
Comparison with Android’s DataSource
Unlike Android’s
DataSourceDecorator which applies globally, Flutter’s template overrides are scoped to the component instance. To apply the same customization everywhere, pass the same template list to each CometChatMessageList instance.Related
- Message Template — Full template structure and examples.
- Menu & Options — Component-level option customization.
- Text Formatters — Custom text processing.
- Customization Overview — See all customization categories.