Browse SDKs · Flutter
Platform
SDKsFlutter

Create a rich-text message

Create a rich-text message with the OpenIM Flutter SDK.

Copy

Construct a rich-text message containing hyperlinks, highlights, and custom embedded entities:

Parameters

ParameterTypeRequiredDescription
textStringYesThe complete body text of the rich message.
listList<RichMessageInfo>?NoList of rich-text entity definitions containing link URLs, character offsets, and length metadata.

Code example

final message = await OpenIM.iMManager.messageManager
    .createAdvancedTextMessage(text: text, list: entities);

The offset and length of each RichMessageInfo item must be calculated against the final body text. We recommend validating URLs and additional metadata before passing.

Return value

Returns a Future resolving to a rich-text Message object ready for transmission. Its payload is stored in advancedTextElem.

State changes after the call

Creating a message only constructs the local message data structure in memory; it does not perform network transmission and does not trigger new-message event callbacks. Once constructed, pass the returned Message instance to Send a message to deliver it to a direct or group conversation.