addAllWhile method

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

Implementation

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