promiseToFuture<T> function
Implementation
Future<T> promiseToFuture<T>(Promise promise) {
var completer = Completer<T>.sync();
promise.then(allowInterop((value) {
completer.complete(value);
}), allowInterop((error) {
completer.completeError(error);
}));
return completer.future;
}