getOrThrow method

  1. @override
V getOrThrow(
  1. K key
)
override

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

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

Implementation

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