unwrapOrElse abstract method
T
unwrapOrElse(
- T fallback(
- E error
Returns the contained Ok
(success) value
or computes it from the closure.
Examples
Basic usage:
int count(String x) => x.length;
expect(Ok<int, String>(2).unwrapOrElse(count), 2);
expect(Errint, String>('foo').unwrapOrElse(count), 3);
Implementation
T unwrapOrElse(T Function(E error) fallback);