toJS property
A JSPromise that either resolves once this Future completes or rejects with an object that contains its error.
The rejected object contains the original error as a JSBoxedDartObject
in the property error and the original stack trace as a String in the
property stack.
Implementation
JSPromise get toJS {
return JSPromise(
(JSFunction resolve, JSFunction reject) {
this.then(
(_) => resolve.callAsFunction(resolve),
onError: (Object error, StackTrace stackTrace) {
final jsError = _convertError(error, stackTrace);
reject.callAsFunction(reject, jsError);
return jsError;
},
);
}.toJS,
);
}