invokeMethod<T> method
Future<T?>
invokeMethod<
T>( - String method, [
- dynamic arguments
])
Implementation
@optionalTypeArgs
Future<T?> invokeMethod<T>(String method, [dynamic arguments]) => _synchronized(
() => _channel.invokeMethod<T>(method, arguments),
).onError(
(error, stack) {
final dynamic obj;
if (error == null) {
obj = method;
} else if (error is PlatformException) {
final String stacktrace;
if (error.stacktrace != null) {
stacktrace = "$method\n${error.stacktrace!}";
} else {
stacktrace = method;
}
obj = PlatformException(
code: error.code,
message: error.message,
details: error.details,
stacktrace: stacktrace,
);
} else {
obj = error;
}
return Future<T>.error(obj, stack);
},
);