getUnreadMessageCountForAllGroups static method
Future<Map<String, int> ?>
getUnreadMessageCountForAllGroups({
- bool? hideMessagesFromBlockedUsers,
- dynamic onSuccess()?,
- dynamic onError(
- CometChatException excep
Gives count of unread messages for every one-on-one and group conversation.
on Success will return 2 keys:
- user - The value for this key holds another map that holds the UIDs of users and their corresponding unread message counts.
- group - The value for this key holds another map that holds the GUIDs of groups and their corresponding unread message counts.
method could throw PlatformException with error codes specifying the cause
Implementation
static Future<Map<String, int>?> getUnreadMessageCountForAllGroups(
{bool? hideMessagesFromBlockedUsers,
Function(Map<String, int> message)? onSuccess,
Function(CometChatException excep)? onError}) async {
try {
final count = await channel.invokeMethod(
'getUnreadMessageCountForAllGroups',
{'hideMessagesFromBlockedUsers': hideMessagesFromBlockedUsers});
final res = Map<String, int>.from(count);
if (onSuccess != null) onSuccess(res);
return res;
} on PlatformException catch (p) {
_errorCallbackHandler(null, p, null, onError);
return null;
} catch (e) {
_errorCallbackHandler(null, null, e, onError);
return null;
}
}