getOnlineUserCount static method

Future<int?> getOnlineUserCount({
  1. required dynamic onSuccess(
    1. int count
    )?,
  2. required dynamic onError(
    1. CometChatException excep
    )?,
})

get the total count of online users for your app

method could throw PlatformException with error codes specifying the cause

Implementation

static Future<int?> getOnlineUserCount(
    {required Function(int count)? onSuccess,
    required Function(CometChatException excep)? onError}) async {
  try {
    final result = await channel.invokeMethod('getOnlineUserCount', {});
    if (onSuccess != null) onSuccess(result);
    return result;
  } on PlatformException catch (p) {
    _errorCallbackHandler(null, p, null, onError);
  } catch (e) {
    _errorCallbackHandler(null, null, e, onError);
  }
  return null;
}