unwrapOrElse method
Returns the contained value, if any, or the result of calculateDefaultValue
otherwise.
Examples
// prints "2"
print(const Ok<int, String>(2).unwrapOrElse((_) => 3));
// prints "3"
print(const Err<int, String>('error').unwrapOrElse((_) => 3));
Implementation
@override
@useResult
T unwrapOrElse(T Function(E error) calculateDefaultValue) => value;