promiseToFuture<T> function
Null safety
- Object jsPromise
Converts a JavaScript Promise to a Dart Future.
@JS()
external Promise<num> get threePromise; // Resolves to 3
void main() async {
final Future<num> threeFuture = promiseToFuture(threePromise);
final three = await threeFuture; // == 3
}
Implementation
external Future<T> promiseToFuture<T>(Object jsPromise);