takeLast method

Iterable<T> takeLast(
  1. int count
)

Takes the last count elements in an iterable.

Implementation

Iterable<T> takeLast(int count) {
  if (count < 0) {
    throw RangeError.value(
        count, 'count', 'The value of "count" cannot be negative.');
  }
  if (count == 0) {
    return Iterable<T>.empty();
  }

  final length = this.count();
  return skip(length - count);
}