SDKsFlutter
Retrieve the total unread count
Retrieve the account’s total unread count with the OpenIM Flutter SDK.
getTotalUnreadMsgCount() returns a snapshot of the current account's total unread count across all conversations. Do not calculate it by simply adding unreadCount from the currently loaded pages.
final value = await OpenIM.iMManager.conversationManager
.getTotalUnreadMsgCount();
final totalUnread = int.tryParse(value.toString()) ?? 0;
updateApplicationBadge(totalUnread);The query itself does not trigger a callback. The application's single OnConversationListener.onTotalUnreadMessageCountChanged handles subsequent changes to the total. See Events overview for listener composition and setup.
Was this page helpful?