get method

V? get(
  1. K key
)

Returns the value associated with key if present, and marks the entry as most recently used. Returns null if key is not found.

Implementation

V? get(K key) {
  if (!_cache.containsKey(key)) return null;

  // Remove and re-insert to update usage order.
  V value = _cache.remove(key) as V;
  _cache[key] = value;
  return value;
}