getOrThrow method

V getOrThrow(
  1. K key
)

Returns the value if it exists, otherwise throws a StateError.

See also: get to return null when the value doesn't exist.

Implementation

V getOrThrow(K key) {
  if (containsKey(key)) {
    return (_map[key] as V);
  } else
    throw StateError("Key does not exist: '$key'");
}