getOrElse method

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

Gets a value from a map, or a default value if the key is absent.

Unlike this[key] ?? defaultValue, a key that is present with a null value returns null rather than the default.

Implementation

V getOrElse(K key, V defaultValue) =>
    containsKey(key) ? this[key] as V : defaultValue;