dropRight method

Iterable<T> dropRight([
  1. int count = 1
])

Drops the last count element of this iterable.

If this iterable contains fewer than count elements, the returned iterable is empty.

The count must be non-negative.

Implementation

Iterable<T> dropRight([int count = 1]) {
  if (count < 0) throw RangeError.range(count, 0, null, "count");
  if (count == 0) return this;
  if (count == 1) return _dropLastHelper(this);
  return _dropRightHelper(this, count);
}