operator []= method

  1. @override
void operator []=(
  1. K key,
  2. V value
)
override

Replaces the value of a key that already exists in the map. However, if the key is not already present, this will throw an error.

Implementation

@override
void operator []=(K key, V value) {
  if (containsKey(key)) {
    _map[key] = value;
  } else
    throw UnsupportedError("Can't add a new key to the map.");
}