Unread Counts
Nexconn Chat UI displays unread counts from BaseChannel.unreadCount and tracks channel-level mention counts from BaseChannel.mentionedMeCount.
| Concept | Source | Used by |
|---|---|---|
| Channel unread count | BaseChannel.unreadCount | Channel list badge and current-channel clear behavior. |
| Mention unread count | BaseChannel.mentionedMeCount and unread mentioned messages query | Unread mention tip inside ChatPage. |
| Total unread count | EngineProvider.totalUnreadCount | App badge, tab badge, or host-app shell. |
| Read receipt users | Message receipt APIs | Per-message receipt detail, not channel unread count. |
Channel List Badge
The default ChannelItem shows an unread badge when ChannelItemConfig.showUnreadBadge is true and the channel unread count is greater than zero.
ChannelConfig(
itemConfig: ChannelItemConfig(
showUnreadBadge: true,
),
)
Counts above 99 are displayed as 99+. Muted channels use a muted badge color.
Custom Badge
Use ChannelItemConfig.unreadBadgeBuilder to replace the default badge.
ChannelItemConfig(
unreadBadgeBuilder: (context, channel, unreadCount, config) {
return DecoratedBox(
decoration: const BoxDecoration(
color: Colors.black,
shape: BoxShape.circle,
),
child: Padding(
padding: const EdgeInsets.all(6),
child: Text(
unreadCount > 99 ? '99+' : '$unreadCount',
style: const TextStyle(color: Colors.white),
),
),
);
},
)
Total Unread Count
EngineProvider maintains the aggregate unread count for the app.
final total = context.watch<EngineProvider>().totalUnreadCount;
Update it when your app has a freshly computed aggregate unread count from the SDK or your own app state.
context.read<EngineProvider>().updateTotalUnreadCount(total);
Clearing Unread State
ChatProvider.clearUnreadCount clears the current channel through the SDK and reduces the aggregate unread count tracked by EngineProvider.
await chatProvider.clearUnreadCount();
The standard chat page calls this automatically when the page becomes active and when current-channel messages are received.
Unread History and Mentions
When a chat page opens with unread messages, the message list can show an unread-history tip. The tip uses:
ChatProvider.unreadHistoryCountChatProvider.unreadMentionCountChatProvider.unreadMentionedMessages
final mentionedMessages =
await chatProvider.getUnreadMentionedMessages();
ChatPageConfig(
messageListConfig: MessageListConfig(
showUnreadHistoryTip: true,
unreadHistoryTipText: 'New messages',
),
)
Calling dismissUnreadHistoryTip hides the tip in the current UI state.
chatProvider.dismissUnreadHistoryTip();
Message read receipts are separate from unread channel counts. Use the read-receipt user list APIs only when the underlying message and SDK state support receipt details.