then<R> method
Same as Future.then.
- Note: it's not possible to implement
onError
with the same behavior at Future.then, sinceonError
will be called only ifthis
is a Future, and not when it's aT
. - See asyncTry.
Implementation
FutureOr<R> then<R>(FutureOr<R> Function(T value) onValue,
{Function? onError}) {
var self = this;
if (self is Future<T>) {
return self.then(onValue, onError: onError);
} else {
return onValue(self);
}
}