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