getOnlineGroupMemberCount static method

Future<Map<String, int>?> getOnlineGroupMemberCount(
  1. List<String> guids, {
  2. required dynamic onSuccess(
    1. Map<String, int> result
    )?,
  3. required dynamic onError(
    1. CometChatException excep
    )?,
})

get the total count of online users in particular groups

guids list of group ids

method could throw PlatformException with error codes specifying the cause

Implementation

static Future<Map<String, int>?> getOnlineGroupMemberCount(List<String> guids, {required Function(Map<String, int> result)? onSuccess, required Function(CometChatException excep)? onError}) async {
  try {
    final result = await channel.invokeMethod('getOnlineGroupMemberCount', {
      'guids': guids,
    });
    final Map<String, int> res = Map<String, int>.from(result);
    if(onSuccess != null) onSuccess(res);
    return res;
  } on PlatformException catch (platformException) {
    if(onError != null) onError(CometChatException(platformException.code, platformException.details, platformException.message));
  } catch (e) {
    debugPrint("Error: $e");
    if(onError != null) onError(CometChatException(ErrorCode.errorUnhandledException, e.toString() , e.toString()));
  }
  return null;
}