valueOr method

T valueOr(
  1. T defaultValue
)

Returns the expected value if it exists, otherwise returns defaultValue.

Implementation

T valueOr(T defaultValue) {
  return _hasValue ? (_value as T) : defaultValue;
}