removeAll method

List<V> removeAll()

Removes all entries from the lookup table and returns the associated values in the order of their corresponding keys.

final lookup = WebSocketManagerLookup();
lookup[MultiKey(['a', 'b', 'c'])] = 1000;
lookup[MultiKey(['x', 'y', 'z'])] = 2000;

print(lookup.removeAll());  // [1000, 2000]
print(lookup);              // {}

Implementation

List<V> removeAll() {
  final List<V> values = _table.values.toList(growable: false);
  _table.clear();
  return values;
}