callMethodAwaitPromise method
Implementation
Future<dynamic> callMethodAwaitPromise(String method,
[List<dynamic>? arguments]) {
JSObject promiseObject = callMethod(method, arguments);
final completer = Completer();
(promiseObject.callMethod("then", [
(result) {
completer.complete(result);
}
]) as JSObject)
.callMethod("catch", [
(error) {
completer.completeError(error);
}
]);
return completer.future;
}