then<R> method
Same as Future.then.
- Note: it's not possible to implement
onErrorwith the same behavior at Future.then, sinceonErrorwill be called only ifthisis 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);
}
}