ms_map_utils library

Extensions

MapUtils on Map<K, V>

Functions

compact<K, V>(Map map, [bool newMap = false]) Map<K, V>
Remove all entries that value is null
containsKeys(Map map, List<Object> listOfKey, {ContainsKeysRules? rule = ContainsKeysRules.none}) bool
Return true if map contains all keys in list of keys
diff(Map from, Map to, [bool skipNested = false]) Map
Returns a new map contend only difference between maps from Reference map to Map to compare skipNested If true will skip any nested map and only process if maps is equals.
doIfContains<T>(Map map, dynamic key, {required T doWork(dynamic key, dynamic value), T elseIf()?}) → T?
Return a result of doWork if a map contains a key or return a result of elseIf if non null else will return null
listCombine<K, V>(List<K> keys, List<V> values) Map<K, V>
creates an Map by using one array for keys and another for its values keys a list of keys for the Map values a list of values fot the Map return a Map with keys and values combine
putIfAbsentAsync<V>(Map<dynamic, V> map, String key, Future<V> ifAbsent()) Future<V?>
Return a value if it exists in map or call ifAbsent that's return a new value and insert him on map
reduce<T>(Map map, ReduceFunction<T> reduceFunction) → T?
Reduce function
removeKeys(Map map, List keys, [bool recursive = false]) → void
Remove all values that matches in list of keys
removeKeysExcept(Map map, List keys, [bool recursive = false]) → void
Remove all values except that matches in list of keys
trim(Map map, [bool newMap = false]) Map
Apply trim in all String values on tree

Typedefs

ReduceFunction<F> = F Function(F? accumulated, dynamic currentKey, dynamic currentValue)