unwrapOrElse method
T
unwrapOrElse(
- T onErr(
- E error
Returns the success value if this is Ok, otherwise computes a fallback
using onErr.
Result.err('bad').unwrapOrElse((e) => e.length); // 3
Implementation
T unwrapOrElse(T Function(E error) onErr) => isOk ? (this as Ok<T, E>).value : onErr((this as Err<T, E>).error);