rejectCall static method

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

Implementation

static void rejectCall(String sessionID, String status,
    {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 if (status.isEmpty) {
      onError(CometChatException(
          "Error", "Call status is null", "Call status is null"));
    } else {
      var result = await channel.invokeMethod(
          'rejectCall', {"sessionID": sessionID, "status": status});
      if (onSuccess != null) onSuccess(Call.fromMap(result));
    }
  } on PlatformException catch (p) {
    _errorCallbackHandler(null, p, null, onError);
  } catch (e) {
    _errorCallbackHandler(null, null, e, onError);
  }
}