mapSuccess<R> method
Transforms the contained success
value based on the result of the callback function f
.
Implementation
Deferred<R> mapSuccess<R>(
R Function(T result) f,
) {
if (this is _InProgress) {
return Deferred.inProgress();
} else if (this is _Error) {
final err = this as _Error;
return Deferred.error(err.error, err.stackTrace);
} else if (this is _Success) {
final success = this as _Success<T>;
return Deferred.success(f(success.results));
} else {
return Deferred.idle();
}
}