operator [] method

  1. @override
Future<V> operator [](
  1. String key
)
override

Obtains values associated with key.

If the given key causes containsKey returns false, it must throws InvalidDictionaryKeyError.

Implementation

@override
Future<V> operator [](String key) async {
  await for (DictionaryEntry<V> de in entries) {
    if (de.key == key) {
      return de.value;
    }
  }

  throw InvalidDictionaryKeyError(
      key, "No corresponded entry found with associated key.");
}