asyncMapResult<T> method

Stream<Result<T>> asyncMapResult<T>(
  1. Future<T> mapSuccess(
    1. E
    ), {
  2. String? tag,
})

Map the current Result stream to a new Result one, which could be from a different type.

Use the mapSuccess callback to map the success from the current stream to the result stream in an async manner.

Example:

Result<String> result = Stream.value(Result.success(10))
  .asyncMapResult((value) async => value * 10)
  .asyncMapResult((value) async => value.toString()); // Result.success('100')

Implementation

Stream<Result<T>> asyncMapResult<T>(
  Future<T> Function(E) mapSuccess, {
  String? tag,
}) =>
    asyncMap(
      (result) => result.asyncMapResult(mapSuccess, tag: tag),
    );