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
-
- Map<
K, V>
- Map<
Methods
-
add(
MapEntry< K, V> entry) → void - Adds a single entry to the map.
-
removeAll(
List< K> keys) → Map<K, V> -
Available on Map<
Removes all entries with keys that are in the providedK, V> , provided by the MapTools extensionkeys
list. -
select(
List< K> selectKeys) → Map<K, V> -
Available on Map<
Selects all entries from the map whose keys are in the providedK, V> , provided by the MapTools extensionselectKeys
list.