pick method

Map<K, V> pick(
  1. Iterable<K> keys
)

Returns a new map containing only the entries for the given keys.

Example:

print({'a': 1, 'b': 2}.pick(['a'])); // {'a': 1}

Implementation

Map<K, V> pick(Iterable<K> keys) {
  return Map.fromEntries(entries.where((e) => keys.contains(e.key)));
}