Skip to main content
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)
Components call MessageTemplateUtils internally to get defaults. You override behavior by passing custom templates, options, or formatters directly to the component.

Getting Default Templates

Available Template Methods

Overriding Templates

Replace All Templates

Pass a complete list of templates to CometChatMessageList:

Add or Override Specific Templates

Use addTemplate to merge custom templates with defaults. Templates are keyed by category_type — if your template matches an existing key, it overrides the default:

Message Options

Getting Default Options

Option Methods by Message Type

Text Formatters

Type and Category Lists

Used when building custom MessagesRequestBuilder instances:

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.