removeAt method
Removes a MultiKey and its associated value from the lookup table. The lookup is performed
on the column index only.
Returns the value associated with key at column index, before it was removed.
Returns null if key at columns index was not in the lookup table.
final lookup = WebSocketManagerLookup(); // 0 1 2
lookup[MultiKey(['a', 'b', 'c'])] = 1000; // ['a', 'b', 'c'] => 1000
lookup[MultiKey(['x', 'y', 'z'])] = 2000; // ['x', 'y', 'z'] => 2000
print(lookup.removeAt('c', index: 0)); // null
print(lookup.removeAt('c', index: 1)); // null
print(lookup.removeAt('c', index: 2)); // 1000
Implementation
V? removeAt(final dynamic key, { required final int index }) {
predicate(final K multiKey) => multiKey[index] == key;
return _table.remove(_find(predicate)?.key);
}