compact method

Map<K, V> compact()

Returns a new non-null Map by filtering out null values in the this Map.

Implementation

Map<K, V> compact() {
  Map<K, V> map = {};

  for (final entry in entries) {
    final value = entry.value;
    if (value != null) {
      map[entry.key] = value;
    }
  }

  return map;
}