Browse SDKs · Flutter
Platform
SDKsFlutter

Insert a local group message

Use the Flutter SDK to insert a local message into a group conversation.

Copy

Insert a local placeholder or system notification message into the local group chat history on the current device only, without performing network delivery:

Parameters

ParameterTypeRequiredDescription
groupIDStringYesTarget group ID.
senderIDStringYesUser ID of the message sender (can be the current user or a virtual system user ID).
messageMessageYesThe complete message object to persist locally.

Code example

final stored = await OpenIM.iMManager.messageManager
    .insertGroupMessageToLocalStorage(
  groupID: groupID,
  senderID: senderUserID,
  message: localMessage,
);

While parameters are marked nullable in the underlying SDK declaration, you must supply non-empty values to guarantee correct local routing.

Return value

Returns a Future resolving to the persisted Message object. Merge it into your active group chat UI list using its clientMsgID.

State changes after the call

This operation modifies only the local database on the current device. It does not synchronize to server roaming history, is not sent to other group members, and does not emit cross-device event notifications. When real network delivery to group members is required, see Send a message; to insert a local message in a direct chat, see Insert a local single-chat message.