skipLast method

Iterable<T> skipLast(
  1. int count
)

Skips the last count elements in an iterable.

Implementation

Iterable<T> skipLast(int count) {
  final length = this.count();
  if (length < count) {
    throw ArgumentError.value(count, 'count',
        'The value of "count" cannot be greater than the length of the iterable.');
  }

  if (length == count) {
    return Iterable.empty();
  }

  return take(length - count);
}