operator [] method
Returns the value at index
.
Throws a RangeError if index
is out of bounds.
Implementation
dynamic operator [](int index) {
_checkRange(index);
if (numDimensions == 1) {
return _data[index];
}
final NdArray ndArray = NdArray(numDimensions - 1);
if (_data[index] is List) {
ndArray._data = _data[index];
} else {
ndArray._data = [_data[index]];
}
return ndArray;
}