removeRange method
Returns a copy of this list where the objects in the range start
inclusive to end
exclusive are removed from.
The provided range, given by start
and end
, will be adjusted to fit
inside the boundaries of the list if necessary, i.e. to fulfill
0 <= start <= end <= len
, where len
is this list's length.
If the resulting range is empty, the list is returned unchanged.
Implementation
ImmortalList<T> removeRange(int start, int end) => _withRange(
start,
end,
(range) => _mutateAsListIf(
range.isNotEmpty,
(list) => list..removeRange(range.start, range.end),
));