endCall static method

void endCall(
  1. String sessionID, {
  2. required dynamic onSuccess(
    1. Call call
    )?,
  3. required dynamic onError(
    1. CometChatException excep
    ),
})

Implementation

static void endCall(String sessionID,
    {required Function(Call call)? onSuccess,
    required Function(CometChatException excep) onError}) async {
  try {
    if (sessionID.isEmpty) {
      onError(CometChatException(
          "Error", "Session ID is null", "Session ID is null"));
    } else {
      var result =
          await channel.invokeMethod('endCall', {"sessionID": sessionID});
      if (onSuccess != null) onSuccess(Call.fromMap(result));
    }
  } on PlatformException catch (p) {
    _errorCallbackHandler(null, p, null, onError);
  } catch (e) {
    _errorCallbackHandler(null, null, e, onError);
  }
}