at<T extends NativeType> method

Pointer<T> at<T extends NativeType>(
  1. int index
)

Returns the element at the specified index.

  • index: The index of the element to retrieve. Returns a pointer to the element at the specified index. Throws a RangeError if the index is out of bounds.

Implementation

Pointer<T> at<T extends NativeType>(int index) {
  if (index < 0 || index >= length) {
    throw RangeError('Index out of bounds');
  }
  return (data + (index * elementSize)).cast<T>();
}