invokeRequest<TOptions extends RequestOptions> method
Future<Map<String, dynamic> >
invokeRequest<TOptions extends RequestOptions>({
- required String method,
- required ApiRequest<
TOptions> request, - bool? throwOnNull = true,
Implementation
Future<Map<String, dynamic>> invokeRequest<TOptions extends RequestOptions>({
required final String method,
required final ApiRequest<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 ApiException.fromPlatformException(e);
}
if (result == null && throwOnNull == true) {
throw const ApiException.unknown('Channel returned null.');
}
return result ?? {};
}