mapOr<U> method

U mapOr<U>(
  1. U op(
    1. T
    ),
  2. U opt
)
inherited

Applies a function to the contained value (if any), or returns the provided default (if not).

Implementation

U mapOr<U>(U Function(T) op, U opt) {
  final val = toNullable();
  if (val != null) {
    return op(val);
  } else {
    return opt;
  }
}