slice<T> function
Creates a slice of list
from start
up to, but not including, end
.
var list = [1, 2, 3, 4];
// Does not alters list object and returns a new sliced list object
var newSlicedList = slice(list, 2); // newSlicedList = [3, 4]
// Direclty slices the list and does not makes a new object.
var old_object_slicedList = list.slice(2); // [3, 4]
Implementation
List<T>? slice<T>(List<T> list, int start, [int? end]) {
return list._privateSlice(start, end, false) as List<T>?;
}