Browse SDKs · Flutter
Platform
SDKsFlutter

Delete a local message

Use the Flutter SDK to delete one message from the current device only.

Copy

Delete a single specified message from the local database on the current device only:

Parameters

ParameterTypeRequiredDescription
conversationIDStringYesID of the conversation containing the message.
clientMsgIDStringYesTarget client message ID to delete.

Code example

await OpenIM.iMManager.messageManager.deleteMessageFromLocalStorage(
  conversationID: conversationID,
  clientMsgID: clientMsgID,
);

Return value

Future completion indicates that the target message has been removed from the current device's local database. Remove the record from your local state and UI list using the composite key conversationID:clientMsgID.

State changes after the call

This operation modifies only the local storage on the current device. It does not delete the server-side roaming record, does not notify other devices or chat participants, and does not constitute a message recall. If you need to delete a message from both local storage and the server with cross-device synchronization, see Delete saved messages; to recall a message and display a placeholder, see Revoke a message.