map<U> method

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

Maps the success value using the given function, preserving failures

Implementation

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