check method
Checks if the given index is within bounds and throws an error if not.
index
: The index to check.
Implementation
void check(int index) {
if (index < 0 || index >= _length) {
throw RangeError.range(index, 0, _length - 1, 'index',
'Index out of bounds for $_debugName');
}
}