getOrElse method

V getOrElse(
  1. K key,
  2. V defaultValue()
)

Returns the value for the given key, or the result of the defaultValue function if there was no entry for the given key.

Implementation

V getOrElse(K key, V Function() defaultValue) {
  return get(key) ?? defaultValue();
}