flatMapAsync<R> method
FutureOr<Result<R> >
flatMapAsync<R>(
- Future<
R> onSuccess(- T value
- ExceptionHandler? exceptionHandler,
- String? errorGroup,
override
Similar to flatMap, but for asynchronous operations. Maps a Result<T> to FutureOr<Result<R>>.
onSuccess
is the function that asynchronously transforms the value if the result is a success.
exceptionHandler
is an optional handler for any exceptions thrown during the transformation.
errorGroup
is an optional group identifier for the error.
Implementation
@override
FutureOr<Result<R>> flatMapAsync<R>(
Future<R> Function(T value) onSuccess, {
ExceptionHandler? exceptionHandler,
String? errorGroup,
}) =>
Result.fromAsync(
() => onSuccess(_value),
exceptionHandler: exceptionHandler,
errorGroup: errorGroup,
);