drop method

List<E> drop(
  1. int n
)

Returns a new list containing all elements except first n elements.

Implementation

List<E> drop(int n) {
  if (n < 0) {
    throw ArgumentError('Requested element count $n is less than zero.');
  }
  if (n == 0) toList();

  var resultSize = length - n;
  if (resultSize <= 0) return [];
  if (resultSize == 1) return [last];
  return sublist(n);
}