remove method

V? remove (
  1. Object? key
)
override

Removes key and its associated value, if present, from the map.

Returns the value associated with key before it was removed. Returns null if key was not in the map.

Note that some maps allow null as a value, so a returned null value doesn't always mean that the key was absent.

Implementation

V? remove(Object? key) {
  if (!_validKey(key)) return null;
  _SplayTreeMapNode<K, V>? mapRoot = _remove(key as dynamic);
  if (mapRoot != null) return mapRoot.value;
  return null;
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.13.0/dart-collection/SplayTreeMap/remove.html