mapOr<U> method

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

Returns the provided default (if Err), or applies a function to the contained value (if Ok),

Arguments passed to mapOr are eagerly evaluated; if you are passing the result 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) =>
    isOk ? f(_okValue) : defaultValue;