getOrThrow method

V getOrThrow(
  1. K key
)

Returns the value associated with this key. It will throw if the key doesn't exist in the map. Note this may only return null if V is nullable.

This is the same as using the [] operator.

Implementation

V getOrThrow(K key) {
  if (_map.containsKey(key))
    return _map[key] as V;
  else {
    if (_allowedInExpando(key))
      return _expando[key!] as V;
    else
      throw StateError("No value for key.");
  }
}