at method

T at(
  1. int index
)

Random access: retrieves the element at index. Note: O(N) complexity due to underlying ListQueue implementation.

Implementation

T at(int index) {
  if (index < 0 || index >= _queue.length) {
    throw RangeError.index(index, this, 'Index out of bounds');
  }
  return _queue.elementAt(index);
}