mapOrElse<U> method

U mapOrElse<U>(
  1. U defaultFn(),
  2. U f(
    1. T
    )
)

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

Implementation

U mapOrElse<U>(U Function() defaultFn, U Function(T) f) {
  if (v == null) {
    return defaultFn();
  } else {
    return f(v!);
  }
}