maybeAddToSet<T> function

Set<T>? maybeAddToSet<T>(
  1. Set<T>? source,
  2. Set<T>? add
)

Adds add to source if both are not null.

Implementation

Set<T>? maybeAddToSet<T>(Set<T>? source, Set<T>? add) {
  if (source == null) return source;
  if (add == null) return source;
  return {...source, ...add};
}