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 (exception) {
    onError(CometChatException(exception.code, exception.message, exception.details));
  } catch (e) {
    onError(CometChatException("Error", "Something went wrong", e.toString()));
  }
}