skipLastTo method

Iterable<E> skipLastTo(
  1. E element
)

Returns the list prefix before the last occurrence of element. If the element is not found return the empty list.

Implementation

Iterable<E> skipLastTo(E element) {
  final index = lastIndexOf(element);
  if (index < 0) return getRange(0, 0);
  return getRange(0, index);
}