addIf method

void addIf(
  1. bool condition,
  2. T element, [
  3. dynamic callbackIfTrue(
    1. T
    )?
])

Implementation

void addIf(bool condition, T element, [Function(T)? callbackIfTrue]) {
  if (condition) {
    add(element);
    if (callbackIfTrue != null) {
      callbackIfTrue(element);
    }
  }
}