invokeRequest<TOptions extends RequestOptions> method

Future<Map<String, dynamic>> invokeRequest<TOptions extends RequestOptions>({
  1. required String method,
  2. required WebAuthRequest<TOptions> request,
  3. bool? throwOnNull = true,
})

Implementation

Future<Map<String, dynamic>> invokeRequest<TOptions extends RequestOptions>({
  required final String method,
  required final WebAuthRequest<TOptions> request,
  final bool? throwOnNull = true,
}) async {
  final Map<String, dynamic>? result;
  try {
    result = await _channel.invokeMapMethod(method, request.toMap());
  } on PlatformException catch (e) {
    throw WebAuthenticationException.fromPlatformException(e);
  }

  if (result == null && throwOnNull == true) {
    throw const WebAuthenticationException.unknown('Channel returned null.');
  }

  return result ?? {};
}