answerCall method

  1. @override
Future<void> answerCall({
  1. required dynamic callback(
    1. FlyResponse response
    ),
})
override

This method is used to answer the call

Implementation

@override
Future<void> answerCall(
    {required Function(FlyResponse response) callback}) async {
  if (Platform.isAndroid) {
    try {
      LogMessage.d("answerCall", "answerCall");
      await mirrorFlyCallMethodChannel.invokeMethod<bool>('answerCall');
      callback
          .call(FlyResponse(true, FlyConstants.empty, FlyConstants.empty));
    } on PlatformException catch (e) {
      LogMessage.d("Platform Exception =", " $e");
      callback.call(FlyResponse(false, FlyConstants.empty, FlyConstants.empty,
          FlyException(e.code, e.message, e.details)));
    } on Exception catch (e) {
      LogMessage.d("Exception ", " $e");
      callback.call(FlyResponse(false, FlyConstants.empty, FlyConstants.empty,
          FlyException(FlyErrorCode.unHandle, FlyErrorMessage.unHandle, e)));
    }
  } else {
    const String errorMessage = "This method call is not supported for iOS";
    LogMessage.d("Exception ", " $errorMessage");
    callback.call(FlyResponse(
        false,
        FlyConstants.empty,
        FlyConstants.empty,
        FlyException(
            FlyErrorCode.unHandle, FlyErrorMessage.unHandle, errorMessage)));
  }
}