unwrapOrElse abstract method
T
unwrapOrElse(
- T fallback(
- E error
Returns the successful value, or computes one from the error.
final count = const Err<int, String>('invalid')
.unwrapOrElse((error) => error.length);
final existing = const Ok<int, String>(7)
.unwrapOrElse((error) => error.length);
Implementation
T unwrapOrElse(T Function(E error) fallback);