mapOr<U> method

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

Returns the provided default (if None), or applies a function to the contained value (if Some),

Arguments passed to mapOr are eagerly evaluated; if you are passing the option of a function call, it is recommended to use mapOrElse, which is lazily evaluated.

Implementation

U mapOr<U>(U defaultValue, U Function(T value) f) =>
    isSome ? f(_someValue) : defaultValue;