Browse SDKs · Flutter
Platform
SDKsFlutter

Create an @ mention message

Create a group @ text message with the OpenIM Flutter SDK.

Copy

Construct a group text message that mentions (@) specific group members or all members:

Parameters

ParameterTypeRequiredDescription
textStringYesBody content of the message including the @ mention display text.
atUserIDListList<String>YesList of user IDs to mention. Can include the mention-all identifier to notify all members.
atUserInfoListList<AtUserInfo>?NoList of detailed member metadata (user ID and group nickname) used to render mentions in UI.
quoteMessageMessage?NoOptional original message to quote alongside the mention; pass null if not quoting.

Code example

final message = await OpenIM.iMManager.messageManager.createTextAtMessage(
  text: '@$userID Please confirm',
  atUserIDList: [userID],
  atUserInfoList: [AtUserInfo(atUserID: userID, groupNickname: nickname)],
  quoteMessage: quotedMessage,
);

Return value

Returns a Future resolving to a mention Message object ready for transmission. Its payload is stored in atTextElem.

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, specifying the target group ID.