mapOr<U> abstract method
- @useResult
- U map(
- T value
- U defaultValue
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
@useResult
U mapOr<U>(U Function(T value) map, U defaultValue);