Skip to main content
CometChatUrlFormatter extends CometChatTextFormatter to detect URLs in text messages and render them as clickable links.

Overview

The URL formatter is included by default in the Flutter UI Kit. It automatically:
  • Detects URLs in message text using regex patterns
  • Styles URLs with underline and link color
  • Opens URLs in the browser when tapped

Default Behavior

The CometChatUrlFormatter is automatically applied to messages. URLs are:
  • Styled with underline decoration
  • Colored based on bubble alignment (white for outgoing, info color for incoming)
  • Clickable - tapping opens the URL in the default browser

Usage

Basic Usage (Default)

The URL formatter is included by default. No additional setup required.

Custom URL Formatter

Create a custom URL formatter with your own styling and behavior.

Apply Custom Formatter


Customization

Override getMessageBubbleTextStyle to customize link appearance:

Custom URL Pattern

Use a custom regex pattern to match specific URL formats:

Handle URL Clicks

Override getAttributedText to add custom click handling:

Properties


Complete Example


Next Steps

Custom Text Formatter

Build custom inline text patterns.

Message List

Render real-time message threads.

All Guides

Browse all feature and formatter guides.

Sample App

Full working sample application on GitHub.