orElse method

Option<T> orElse(
  1. Option<T> f()
)

Returns the option if it contains a value, otherwise calls f and returns the result.

Implementation

@pragma("vm:prefer-inline")
Option<T> orElse(Option<T> Function() f) {
  if (v == null) {
    return f();
  } else {
    return Some(v!);
  }
}