Map<K, V> filter(bool Function(K key, V value) test) { if (this == null) return {}; final map = <K, V>{}; this!.forEach((key, value) { if (test(key, value)) map[key] = value; }); return map; }