mapOr<U> method

U mapOr<U>(
  1. U defaultValue,
  2. U f(
    1. T
    )
)

Returns the provided default result (if none), or applies a function to the contained value (if any).

Implementation

@pragma("vm:prefer-inline")
U mapOr<U>(U defaultValue, U Function(T) f) {
  if (v == null) {
    return defaultValue;
  } else {
    return f(v!);
  }
}