filterKeys<K, V> function Null safety

Map<K, V> filterKeys<K, V>(
  1. Map<K, V> source,
  2. bool filter(
    1. K key
    )
)

Implementation

Map<K, V> filterKeys<K, V>(Map<K, V> source, bool filter(K key)) =>
    source.entries
        .where((e) => filter(e.key))
        .toList()
        .asMap()
        .map((_, e) => e);