okOr<E> method
Transforms an Option into a Result, mapping Some to an Ok of the contained value and
None to Err of error
.
Examples
// prints "Ok(2)"
print(const Some(2).okOr('none'));
// prints "Err(none)"
print(const None<int>().okOr('none'));
Implementation
@override
@useResult
Ok<T, E> okOr<E>(E error) => Ok(value);