filterKeys<K, V> method

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

Filter where the key is in the given keys. Returns a new map with filtered entries.

Implementation

Map<K, V> filterKeys<K, V>(Iterable<K> keys) {
  final map = <K, V>{};
  for (final key in keys) {
    if (containsKey(key)) {
      map[key] = this[key] as V;
    }
  }
  return map;
}