Skip to main content

Unread Counts

Nexconn Chat UI displays unread counts from BaseChannel.unreadCount and tracks channel-level mention counts from BaseChannel.mentionedMeCount.

ConceptSourceUsed by
Channel unread countBaseChannel.unreadCountChannel list badge and current-channel clear behavior.
Mention unread countBaseChannel.mentionedMeCount and unread mentioned messages queryUnread mention tip inside ChatPage.
Total unread countEngineProvider.totalUnreadCountApp badge, tab badge, or host-app shell.
Read receipt usersMessage receipt APIsPer-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.

Dart
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.

Dart
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.

Dart
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.

Dart
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.

Dart
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.unreadHistoryCount
  • ChatProvider.unreadMentionCount
  • ChatProvider.unreadMentionedMessages
Dart
final mentionedMessages =
await chatProvider.getUnreadMentionedMessages();
Dart
ChatPageConfig(
messageListConfig: MessageListConfig(
showUnreadHistoryTip: true,
unreadHistoryTipText: 'New messages',
),
)

Calling dismissUnreadHistoryTip hides the tip in the current UI state.

Dart
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.