okOr<E> method
Returns Ok with a present value, or Err with error when absent.
A present null stays present: Some<T?>(null) becomes Ok(null), not
an error, because the value was there.
final id = const None<int>().okOr('no id'); // Err(no id)
Implementation
Result<T, E> okOr<E>(E error) {
return switch (this) {
Some<T>(:final value) => Ok<T, E>(value),
None<T>() => Err<T, E>(error),
};
}