Clear all messages
Use the Flutter SDK to clear all local and server-side messages for the current account.
Permanently clear all historical messages for the current logged-in user from both the local database and the server. This method takes no parameters and is used to wipe an account's message history completely:
Code example
await OpenIM.iMManager.messageManager.deleteAllMsgFromLocalAndSvr();
clearLocalMessageState();Return value
Future completion indicates that the deletion request has been processed on both the server and local storage for the current account.
State changes after the call
This is an irreversible account-level operation. It removes message records from the current user's local database and server-side roaming history; it does not delete message copies saved on other participants' devices. Once the Future completes, clear local in-memory message caches and refresh your UI. Conversation summaries and unread counters subsequently update through conversation listeners, and you can reload the conversation list to reconcile state. If you only want to clear local storage while preserving server roaming history, see Clear all local messages; to delete individual messages, see Delete saved messages.
Was this page helpful?