removeNullValues method
Returns a new map containing the entries of this map excluding entries with null values.
Example:
final map = {'a': 1, 'b': null, 'c': 3};
final filteredMap = map.removeNullValues();
print(filteredMap); // Output: {'a': 1, 'c': 3}
Implementation
Map<T, T> removeNullValues() {
return Map<T, T>.fromEntries(entries.where((entry) => entry.value != null));
}