mapOr<U> method
Returns the contained value, if any, with map
applied to it, or defaultValue
otherwise.
Examples
// prints "some: 2"
print(const Some(2).mapOr((value) => 'some: $value', 'none'));
// prints "none"
print(const None<int>().mapOr((value) => 'some: $value', 'none'));
Implementation
@override
@useResult
U mapOr<U>(U Function(T value) map, U defaultValue) => map(value);