mapAsync method
Transforms the inner Async instance if this is an Async.
Provided for pair-axis symmetry with Result.mapOk/Result.mapErr — real code almost always wants resultMap, fold, or foldResult instead.
Implementation
@override
@visibleForTesting
@pragma('vm:prefer-inline')
Async<T> mapAsync(@noFutures Async<T> Function(Async<T> async) noFutures) {
try {
return noFutures(this);
} on Err catch (err) {
return Async.err(err.transfErr<T>());
} catch (error, stackTrace) {
return Async.err(Err<T>(error, stackTrace: stackTrace));
}
}