andThenAsync<U> method

Future<Result<U, E>> andThenAsync<U>(
  1. Future<Result<U, E>> next(
    1. T value
    )
)

Async variant of andThen for future-returning pipelines.

Implementation

Future<Result<U, E>> andThenAsync<U>(
    Future<Result<U, E>> Function(T value) next) async {
  final self = this;
  if (self is Ok<T, E>) return next(self.value);
  return Err<U, E>((self as Err<T, E>).error);
}