map<U> method

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

Maps a Result<T, E> to Result<U, E> by applying a function to a contained Ok value, leaving an Err value untouched.

This function can be used to compose the results of two functions.

Implementation

Result<U, E> map<U>(U Function(T value) op) =>
    isOk ? Ok(op(_okValue)) : Err(_errValue);