okOrElse<E extends Object> method

Result<T, E> okOrElse<E extends Object>(
  1. E errFn()
)

Transforms the Option

Implementation

Result<T, E> okOrElse<E extends Object>(E Function() errFn) {
  if (v == null) {
    return Err(errFn());
  } else {
    return Ok(v!);
  }
}