Clear all local messages
Use the Flutter SDK to clear all local messages for the current account.
Clear all message records stored in the local database for the current logged-in account on this device. This method takes no parameters and is suitable for releasing storage space or resetting local message cache:
Code example
await OpenIM.iMManager.messageManager.deleteAllMsgFromLocal();
clearLocalMessageState();Return value
Future completion indicates that all historical message records have been deleted from the current device's local database.
State changes after the call
This is a local-only destructive operation that modifies solely the device's local storage. It does not delete messages stored on the server and does not emit cross-device message deletion events. If the user subsequently fetches roaming history or logs in on another device, server-side messages continue to synchronize normally. To delete all messages permanently from both local storage and the server, see Clear all messages; to delete a single local message, see Delete a local message.
Was this page helpful?