operator [] method

  1. @override
V? operator [](
  1. Object? key
)
override

Get the value for a key in the Map. The key will be promoted to the 'Most Recently Used' position.

NOTE: Calling [] inside an iteration over keys/values is currently unsupported; use keys or values if you need information about entries without modifying their position.

Implementation

@override
V? operator [](Object? key) {
  final entry = _entries[key];
  if (entry != null) {
    _promoteEntry(entry);
    return entry.value;
  } else {
    return null;
  }
}