ping static method

Future<void> ping(
  1. {required Function? onSuccess,
  2. required dynamic onError(
    1. CometChatException e
    )?}
)

Implementation

static Future<void> ping({required Function? onSuccess, required Function(CometChatException e)? onError}) async {
  try {
    await channel.invokeMethod('ping', null);
    if(onSuccess != null) onSuccess();
  } 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()));
  }
}