maybeAddToIterable<T> function

Iterable<T>? maybeAddToIterable<T>(
  1. Iterable<T>? source,
  2. Iterable<T>? add
)

Adds add to source if both are not null.

Implementation

Iterable<T>? maybeAddToIterable<T>(Iterable<T>? source, Iterable<T>? add) {
  if (source == null) return source;
  if (add == null) return source;
  return [...source, ...add];
}