W3cubDocs

/Dart 2

sublist method

Uint16List sublist (int start, [ int end ])
override

Returns a new list containing the elements between start and end.

The new list is a Uint16List 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 numbers = Uint16List.fromList([0, 1, 2, 3, 4]);
print(numbers.sublist(1, 3)); // [1, 2]
print(numbers.sublist(1, 3).runtimeType); // Uint16List

If end is omitted, it defaults to the length of this list.

print(numbers.sublist(1)); // [1, 2, 3, 4]

The start and end positions must satisfy the relations 0 ≤ startendthis.length If end is equal to start, then the returned list is empty.

Implementation

Uint16List sublist(int start, [int end]);

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.5.0/dart-typed_data/Uint16List/sublist.html