ms_map_utils 0.2.0+1 copy "ms_map_utils: ^0.2.0+1" to clipboard
ms_map_utils: ^0.2.0+1 copied to clipboard

outdated

A dart package that implement a lot of util functions for a Map

Overview Pub GitHub stars #

A simple lib to incremease Map with usefull functions

Whats MS_Map_Utils do #

Add usefull functions to map:

  • trim trim all Strings in a map it's recursive
  • compact remove all MapEntries thats values is null it's recursive too
  • reduce iterate all items in Map for reduce to a unique value returned from callback ReduceFunction.

Usage #

Just import lib and use extensions, call the functions to starts work:

import 'package:ms_map_utils/ms_map_utils.dart';

Map itsAMap = {'key1':null,'key2':'         just a String withs extras spaces en start and end            '};
itsAMap.compact(); // Output: {'key2':'         just a String withs extras spaces en start and end            '}
itsAMap.trim(); // Output: {'key2':'just a String withs extras spaces en start and end'}

Map mapNumbers = {'key1':50,'key2':7,'key3':71,'key4':45,'key5':5};
// In reduceFunction you must check if `accumulated` is null and set a initial value for it
mapNumbers.reduce<int>((int accumulated, _, value) => (accumulated ?? 0) + (value as int)); // Output 178
20
likes
0
pub points
69%
popularity

Publisher

verified publishermarcussoftware.info

A dart package that implement a lot of util functions for a Map

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

More

Packages that depend on ms_map_utils