MapExtensions<K, V> extension
Common Map extensions
- on
-
- Map<
K, V>
- Map<
Methods
-
filterKeys(
bool predicate(K key)) → Map< K, V> -
Available on Map<
Filters the map based on a condition applied to its keys.K, V> , provided by the MapExtensions extension -
filterValues(
bool predicate(V value)) → Map< K, V> -
Available on Map<
Filters the map based on a condition applied to its values.K, V> , provided by the MapExtensions extension -
getOrDefault(
K key, V defaultValue) → V? -
Available on Map<
Retrieves the value for the specifiedK, V> , provided by the MapExtensions extensionkeyfrom the map. If the key does not exist, returns the provideddefaultValue. -
getOrNull(
K key) → V? -
Available on Map<
Retrieves the value for the specifiedK, V> , provided by the MapExtensions extensionkeyfrom the map. If the key does not exist, returns null. -
invert(
) → Map< V, K> -
Available on Map<
Inverts the map by swapping its keys and values. Assumes that the values are unique.K, V> , provided by the MapExtensions extension -
merge(
Map< K, V> other, V resolve(V v1, V v2)?) → Map<K, V> -
Available on Map<
Merges this map with anotherK, V> , provided by the MapExtensions extensionothermap. For duplicate keys,resolvedetermines the final value. -
toJsonString(
) → String -
Available on Map<
Converts the map to a JSON string.K, V> , provided by the MapExtensions extension -
toJsonStringWithIndent(
[int spaces = 2]) → String -
Available on Map<
Converts the map to a formatted JSON string, with specified indentation.K, V> , provided by the MapExtensions extension