Skip to main content

Unread count

Get unread count for a community channel

Dart
final community = CommunityChannel('<community-id>');
await community.getUnreadCount((count, error) {
if (error == null) {
print('Unread count: $count');
}
});

Get total unread count (all community channels)

Dart
await CommunityChannel.getTotalUnreadCount((count, error) {
if (error == null) {
print('Total unread: $count');
}
});

Get total unread mention count

Dart
await CommunityChannel.getTotalUnreadMentionedCount((count, error) {
if (error == null) {
print('Total unread mentions: $count');
}
});

Get unread mentioned messages for a subchannel

Dart
final subChannel = CommunitySubChannel('<community-id>', '<subchannel-id>');
await subChannel.getUnreadMentionedMessages((messages, error) {
if (error == null && messages != null) {
print('Unread mentioned messages: ${messages.length}');
}
});

Clear unread count

Dart
final subChannel = CommunitySubChannel('<community-id>', '<subchannel-id>');
await subChannel.clearUnreadCount((error) {
if (error == null) {
print('Unread count cleared');
}
});