dropLastWhile method

List<E> dropLastWhile(
  1. bool test(
    1. E element
    )
)

Returns a List containing all elements except first elements that satisfy the given test.

Implementation

List<E> dropLastWhile(bool Function(E element) test) {
  var count = 0;

  for (final element in reversed) {
    if (!test(element)) break;

    count++;
  }

  return dropLast(count);
}