addIf method

List<T?>? addIf(
  1. List<T> from,
  2. bool test(
    1. T element
    )
)

Implementation

List<T?>? addIf(List<T> from, bool Function(T element) test) {
  var index = 0;
  while (index < length) {
    if (test(from[index])) {
      add(from[index]);
    }
    index++;
  }
  return this;
}