get method

V? get(
  1. Object? key
)

Returns the value associated with key, or null if absent or collected.

Implementation

V? get(Object? key) {
  if (key == null || key is! K) return null;

  var k = _EntryKey<K, V>(key);
  // ignore: collection_methods_unrelated_type
  var e = _map[k];
  if (e == null) return null;

  var eKey = e.target;
  var eValue = e.payload;

  if (eKey == null || eValue == null) {
    _map.remove(e);
    _onRemoveEntry(e);
    ++_unpurgedCount;
    return null;
  }

  return eValue;
}