dropWhileLeft method

Iterable<T> dropWhileLeft(
  1. bool predicate(
    1. T t
    )
)

Remove all elements starting from the first as long as predicate returns true.

Implementation

Iterable<T> dropWhileLeft(bool Function(T t) predicate) =>
    foldLeft<Tuple2<bool, Iterable<T>>>(
      const Tuple2(true, []),
      (a, e) {
        if (!a.first) {
          return Tuple2(a.first, a.second.append(e));
        }

        final check = predicate(e);
        return check
            ? Tuple2(check, a.second)
            : Tuple2(check, a.second.append(e));
      },
    ).second;