getOnlineUserCount static method
Future<int?>
getOnlineUserCount({
- required dynamic onSuccess(
- int count
- required dynamic onError(
- 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 (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;
}