addAllIf method

void addAllIf (
  1. dynamic condition,
  2. Iterable<E> elements
)

Adds all elements only if condition resolves to true.

Implementation

void addAllIf(/* bool | Condition */ condition, Iterable<E> elements) {
  if (condition is Condition) condition = condition();
  if (condition is bool && condition) addAll(elements);
}