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);