flatMap<U> method

Result<U, E> flatMap<U>(
  1. Result<U, E> mapper(
    1. T
    )
)

Flat maps the success value using the given function, preserving failures

Implementation

Result<U, E> flatMap<U>(Result<U, E> Function(T) mapper) => switch (this) {
  Success(value: final value) => mapper(value),
  Failure(error: final error) => Result.failure(error),
};