operator [] method
V?
operator [](
- K key
Returns the value for key, or null if key is not in the cache.
Accessing an existing key marks it as the most recently used entry.
Implementation
V? operator [](K key) {
if (!_cache.containsKey(key)) return null;
// Move the accessed entry to the end (most recently used position).
final value = _cache.remove(key);
_cache[key] = value as V;
return value;
}