maybeAddToMap<T1, T2> function

Map<T1, T2>? maybeAddToMap<T1, T2>(
  1. Map<T1, T2>? source,
  2. Map<T1, T2>? add
)

Adds add to source if both are not null.

Implementation

Map<T1, T2>? maybeAddToMap<T1, T2>(Map<T1, T2>? source, Map<T1, T2>? add) {
  if (source == null) return source;
  if (add == null) return source;
  return {...source, ...add};
}