update map extensions

This commit is contained in:
Salvatore Giordano
2021-04-19 16:05:10 +02:00
parent 9eb76732c1
commit 673368a1b2
@@ -1,6 +1,6 @@
/// Useful extension functions for [Map]
extension MapX on Map {
extension MapX<K, V> on Map<K, V> {
/// Returns a new map with null keys or values removed
Map<String?, dynamic> get nullProtected => {...this as Map<String?, dynamic>}
..removeWhere((key, value) => key == null || value == null);
Map<K, V> get nullProtected =>
Map.from(this)..removeWhere((key, value) => key == null || value == null);
}