or<F> method

  1. @override
  2. @useResult
Ok<T, F> or<F>(
  1. Result<T, F> other
)
override

Returns an Ok of the original value if this is an Ok, or other otherwise.

Examples

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

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

Implementation

@override
@useResult
Ok<T, F> or<F>(Result<T, F> other) => Ok(value);