flatMap<U> method

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

Maps Result<T, E> to Result<U, E>, leaving an Err value untouched.

Allows chaining Results without nesting them.

Implementation

Result<U, E> flatMap<U>(Result<U, E> Function(T) f) =>
    isOk ? f(_value) : Result.err(_error);