andThen<U> abstract method

  1. @useResult
Result<U, E> andThen<U>(
  1. Result<U, E> calculateOther(
    1. T value
    )
)

Returns the result of calculateOther if this is an Ok, or an Err of the original error otherwise.

Examples

// prints "Ok(3)"
print(const Ok<int, String>(2).andThen((value) => const Ok(3)));

// prints "Err(error)"
print(const Err<int, String>('error').andThen((value) => const Ok(3)));

Implementation

@useResult
Result<U, E> andThen<U>(Result<U, E> Function(T value) calculateOther);