addIfNotNull method

Map<K, V>? addIfNotNull(
  1. K key,
  2. V value
)

Add item into map if value isn't null Add item into map if key not exist

Implementation

Map<K, V>? addIfNotNull(K key, V value) {
  if (value != null) this?.putIfAbsent(key, () => value);
  return this;
}