Insert a local group message
Use the Flutter SDK to insert a local message into a group conversation.
Insert a local placeholder or system notification message into the local group chat history on the current device only, without performing network delivery:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
groupID | String | Yes | Target group ID. |
senderID | String | Yes | User ID of the message sender (can be the current user or a virtual system user ID). |
message | Message | Yes | The 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.
Was this page helpful?