pickKeys method

Map<K, V> pickKeys(
  1. List<K> keys
)

Returns a new map containing entries whose keys are in the keys list.

Example:

final map = {'a': 1, 'b': 2, 'c': 3};
final filtered = map.pickKeys(['b', 'c']);
print(filtered); // Output: {'b': 2, 'c': 3}

Implementation

Map<K, V> pickKeys(List<K> keys) =>
    Map<K, V>.fromEntries(entries.where((e) => keys.contains(e.key)));