futureToPromise<T> function

Promise futureToPromise<T>(
  1. Future<T> future
)

Creates JS Promise which is resolved when future completes.

See also:

Implementation

Promise futureToPromise<T>(Future<T> future) {
  return Promise(allowInterop((Function resolve, Function reject) {
    future.then((result) => resolve(result), onError: reject);
  }));
}