Delete a message
Use the Flutter SDK to delete one message from a conversation for the current account.
Delete a single historical message for the current account from both the local database and the server:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationID | String | Yes | ID of the conversation containing the message. |
clientMsgID | String | Yes | Target client message ID to delete. |
Code example
await OpenIM.iMManager.messageManager.deleteMessageFromLocalAndSvr(
conversationID: conversationID,
clientMsgID: clientMsgID,
);Return value
Future completion indicates that the message has been deleted from both the server and local storage for the current account. Remove the message from the UI list immediately using the composite key conversationID:clientMsgID.
This operation removes message history only for the current user across logged-in sessions; it does not delete copies stored on other conversation members' devices and does not constitute a message recall.
State changes after the call
Message deletion events are delivered through the onMsgDeletedEnterprise callback in OnAdvancedMsgListener. When the current user deletes a message from another client, this callback notifies the active device. Because Flutter's Message model does not contain a conversationID property, resolve the conversation routing first, then remove the message idempotently using conversationID:clientMsgID. For global listener registration, see Events overview. To revoke a message for all members with a tombstone prompt, see Revoke a message.
Was this page helpful?