get method

V? get(
  1. K key
)

Gets a value from the cache Returns null if the key is not in the cache

Implementation

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

  // Move the accessed key to the end (most recently used)
  final value = _cache.remove(key);
  _cache[key] = value as V;
  return value;
}