filter function

Map<String, dynamic> filter (
  1. Map inputData,
  2. Iterable<String> only
)

Removes undesired fields from a Map.

Implementation

Map<String, dynamic> filter(Map inputData, Iterable<String> only) {
  return inputData.keys.fold(<String, dynamic>{}, (map, key) {
    if (only.contains(key.toString())) map[key.toString()] = inputData[key];
    return map;
  });
}