operator []= method
- int index,
- T value
Sets the element at the specified index to value.
Guarantees memory safety by throwing a RangeError if index is out of bounds.
Implementation
void operator []=(int index, T value) {
if (index < 0 || index >= _data.length) {
throw RangeError.index(index, _data, 'Index out of bounds');
}
_data[index] = value;
}