pluck method

List<T> pluck(
  1. int start, [
  2. int? end
])

Removes and returns a range of elements from this list.

The elements with positions greater than or equal to start and less than end, will be removed from the list. This reduces the list's length by end - start.

Implementation

List<T> pluck(int start, [int? end]) {
  end ??= length;
  assert(start >= 0 && start <= end && end <= length);
  final subset = sublist(start, end);
  removeRange(start, end);
  return subset;
}