MapTools<K, V> extension

Provides utility methods for manipulating Map instances.

This extension adds additional functionality to the Map class, allowing you to easily remove multiple entries, select a subset of entries, and add new entries.

Example usage:

var map = {'a': 1, 'b': 2, 'c': 3};

// Remove keys 'a' and 'c'
map.removeAll(['a', 'c']);
print(map); // Outputs: {'b': 2}

// Select only the key 'b'
var selected = map.select(['b']);
print(selected); // Outputs: {'b': 2}

// Add a new entry
map.add(MapEntry('d', 4));
print(map); // Outputs: {'b': 2, 'd': 4}
on

Methods

add(MapEntry<K, V> entry) → void
Adds a single entry to the map.
removeAll(List<K> keys) Map<K, V>
Removes all entries with keys that are in the provided keys list.
select(List<K> selectKeys) Map<K, V>
Selects all entries from the map whose keys are in the provided selectKeys list.