Conversation Unread Count
Get Total Unread Count
Retrieves the total unread count for all conversation types (excluding chatrooms).
Method
Future<int> getTotalUnreadCount(String? channelId, {IRCIMIWGetTotalUnreadCountCallback? callback});
Parameter Description
| Parameter | Type | Description |
|---|---|---|
| channelId | String | Channel ID, only supported for ultra groups. Pass null for other conversation types. |
| callback | IRCIMIWGetTotalUnreadCountCallback | Callback for the unread count retrieval event. The SDK supports callback-based responses starting from version 5.3.1. Other callback methods are deprecated as of version 5.4.0. If a callback is provided, only the callback will be triggered. |
Return Value
| Return Value | Description |
|---|---|
| Future<int> | The status code of the operation. 0 indicates success, while non-zero values indicate failure. Detailed errors can be found in the error codes. |
Code Example
IRCIMIWGetTotalUnreadCountCallback? callback = IRCIMIWGetTotalUnreadCountCallback(onSuccess: (int? t) {
//...
}, onError: (int? code) {
//...
});
int? ret = await engine?.getTotalUnreadCount(channelId, callback:callback);
Callback Method
- onTotalUnreadCountLoaded
Function(int? code, String? channelId, int? count)? onTotalUnreadCountLoaded;
Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | int | The status code of the callback. 0 indicates success, while non-zero values indicate exceptions. |
| channelId | String | Channel ID, only supported for ultra groups. Pass null for other conversation types. |
| count | int | The unread count. |
Code Example
engine?.onTotalUnreadCountLoaded = (int? code, String? channelId, int? count) {
//...
};
Get Unread Count for a Specific Conversation
Retrieves the unread count for a specific conversation (excluding chatrooms).
Method
Future<int> getUnreadCount(RCIMIWConversationType type, String targetId, String? channelId, {IRCIMIWGetUnreadCountCallback? callback});
Parameter Description
| Parameter | Type | Description |
|---|---|---|
| type | RCIMIWConversationType | The conversation type. |
| targetId | String | The conversation ID. |
| channelId | String | Channel ID, only supported for ultra groups. Pass null for other conversation types. |
| callback | IRCIMIWGetUnreadCountCallback | Callback for the unread count retrieval event. The SDK supports callback-based responses starting from version 5.3.1. Other callback methods are deprecated as of version 5.4.0. If a callback is provided, only the callback will be triggered. |
Return Value
| Return Value | Description |
|---|---|
| Future<int> | The status code of the operation. 0 indicates success, while non-zero values indicate failure. Detailed errors can be found in the error codes. |
Code Example
IRCIMIWGetUnreadCountCallback? callback = IRCIMIWGetUnreadCountCallback(onSuccess: (int? t) {
//...
}, onError: (int? code) {
//...
});
int? ret = await engine?.getUnreadCount(type, targetId, channelId, callback:callback);
Callback Method
- onUnreadCountLoaded
Function(int? code, RCIMIWConversationType? type, String? targetId, String? channelId, int? count)? onUnreadCountLoaded;
Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | int | The status code of the callback. 0 indicates success, while non-zero values indicate exceptions. |
| type | RCIMIWConversationType | The conversation type. |
| targetId | String | The conversation ID. |
| channelId | String | Channel ID, only supported for ultra groups. Pass null for other conversation types. |
| count | int | The unread count. |
Code Example
engine?.onUnreadCountLoaded = (int? code, RCIMIWConversationType? type, String? targetId, String? channelId, int? count) {
//...
};
Get Unread Count by Conversation Types
Retrieves the unread count for multiple specified conversation types (excluding chatrooms).
Method
Future<int> getUnreadCountByConversationTypes(List<RCIMIWConversationType> conversationTypes, String? channelId, bool contain, {IRCIMIWGetUnreadCountByConversationTypesCallback? callback});
Parameter Description
| Parameter | Type | Description |
|---|---|---|
| conversationTypes | List<RCIMIWConversationType> | The collection of conversation types. |
| channelId | String | Channel ID, only supported for ultra groups. Pass null for other conversation types. |
| contain | bool | Whether to include the unread count of muted messages. |
| callback | IRCIMIWGetUnreadCountByConversationTypesCallback | Callback for the event. The SDK supports callback-based responses starting from version 5.3.1. Other callback methods are deprecated as of version 5.4.0. If a callback is provided, only the callback will be triggered. |
Return Value
| Return Value | Description |
|---|---|
| Future<int> | The status code of the operation. 0 indicates success, while non-zero values indicate failure. Detailed errors can be found in the error codes. |
Code Example
IRCIMIWGetUnreadCountByConversationTypesCallback? callback = IRCIMIWGetUnreadCountByConversationTypesCallback(onSuccess: (int? t) {
//...
}, onError: (int? code) {
//...
});
int? ret = await engine?.getUnreadCountByConversationTypes(conversationTypesInt, channelId, contain, callback:callback);
Callback Method
- onUnreadCountByConversationTypesLoaded
Function(int? code, List<RCIMIWConversationType>? conversationTypes, String? channelId, bool? contain, int? count)? onUnreadCountByConversationTypesLoaded;
Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | int | The status code of the callback. 0 indicates success, while non-zero values indicate exceptions. |
| conversationTypes | List<RCIMIWConversationType> | The collection of conversation types. |
| channelId | String | Channel ID, only supported for ultra groups. Pass null for other conversation types. |
| contain | bool | Whether to include the unread count of muted messages. |
| count | int | The unread count. |
Code Example
engine?.onUnreadCountByConversationTypesLoaded = (int? code, List<RCIMIWConversationType>? conversationTypes, String? channelId, bool? contain, int? count) {
//...
};
Clear Unread Count for a Specific Conversation
Clears the unread count for a specific conversation (excluding chatrooms).
Method
Future<int> clearUnreadCount(RCIMIWConversationType type, String targetId, String? channelId, int timestamp, {IRCIMIWClearUnreadCountCallback? callback});
Parameter Description
| Parameter | Type | Description |
|---|---|---|
| type | RCIMIWConversationType | The conversation type. |
| targetId | String | The conversation ID. |
| channelId | String | Channel ID, only supported for ultra groups. Pass null for other conversation types. |
| timestamp | int | The timestamp of the last read message in the conversation. Pass the current latest timestamp to clear all. |
| callback | IRCIMIWClearUnreadCountCallback | Callback for the event. The SDK supports callback-based responses starting from version 5.3.1. Other callback methods are deprecated as of version 5.4.0. If a callback is provided, only the callback will be triggered. |
Return Value
| Return Value | Description |
|---|---|
| Future<int> | The status code of the operation. 0 indicates success, while non-zero values indicate failure. Detailed errors can be found in the error codes. |
Code Example
IRCIMIWClearUnreadCountCallback? callback = IRCIMIWClearUnreadCountCallback(onUnreadCountCleared: (int? code) {
//...
});
int? ret = await engine?.clearUnreadCount(type, targetId, channelId, timestamp, callback:callback);
Callback Method
- onUnreadCountCleared
Function(int? code, RCIMIWConversationType? type, String? targetId, String? channelId, int? timestamp)? onUnreadCountCleared;
Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | int | The status code of the callback. 0 indicates success, while non-zero values indicate exceptions. |
| type | RCIMIWConversationType | The conversation type. |
| targetId | String | The conversation ID. |
| channelId | String | Channel ID, only supported for ultra groups. Pass null for other conversation types. |
| timestamp | int | The timestamp of the last read message in the conversation. |
Code Example
engine?.onUnreadCountCleared = (int? code, RCIMIWConversationType? type, String? targetId, String? channelId, int? timestamp) {
//...
};
Load All @Unread Counts
Loads all @unread counts for a specific conversation.
Method
Future<int> getUnreadMentionedCount(RCIMIWConversationType type, String targetId, String? channelId, {IRCIMIWGetUnreadMentionedCountCallback? callback});
Parameter Description
| Parameter | Type | Description |
|---|---|---|
| type | RCIMIWConversationType | The conversation type. |
| targetId | String | The conversation ID. |
| channelId | String | Channel ID, only supported for ultra groups. Pass null for other conversation types. |
| callback | IRCIMIWGetUnreadMentionedCountCallback | Callback for the @unread count retrieval event. The SDK supports callback-based responses starting from version 5.3.1. Other callback methods are deprecated as of version 5.4.0. If a callback is provided, only the callback will be triggered. |
Code Example
IRCIMIWGetUnreadMentionedCountCallback? callback = IRCIMIWGetUnreadMentionedCountCallback(onSuccess: (int? t) {
//...
}, onError: (int? code) {
//...
});
int? ret = await engine?.getUnreadMentionedCount(type, targetId, channelId, callback:callback);
Callback Method
- onUnreadMentionedCountLoaded
Function(int? code, RCIMIWConversationType? type, String? targetId, String? channelId, int? count)? onUnreadMentionedCountLoaded;
Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | int | The status code of the callback. 0 indicates success, while non-zero values indicate exceptions. |
| type | RCIMIWConversationType | The conversation type. |
| targetId | String | The conversation ID. |
| channelId | String | Channel ID, only supported for ultra groups. Pass null for other conversation types. |
| count | int | The unread count. |
Code Example
engine?.onUnreadMentionedCountLoaded = (int? code, RCIMIWConversationType? type, String? targetId, String? channelId, int? count) {
//...
};