sublist method Null safety
Returns a new list containing the elements between
The new list is a
List<E> containing the elements of this list at
positions greater than or equal to
start and less than
end in the same
order as they occur in this list.
var colors = ["red", "green", "blue", "orange", "pink"]; print(colors.sublist(1, 3)); // [green, blue]
end is omitted, it defaults to the length of this list.
print(colors.sublist(1)); // [green, blue, orange, pink]
end positions must satisfy the relations
end is equal to
start, then the returned list is empty.
List<E> sublist(int start, [int? end]);