addIf method

void addIf(
  1. dynamic condition,
  2. E element
)

Implementation

void addIf(/* bool | Condition */ condition, E element) {
  if (condition is Condition) condition = condition();
  if (condition is bool && condition) add(element);
}