operator [] method

T operator [] (
  1. int index
)
override

Returns the object at the given index in the list or throws a RangeError if index is out of bounds.

Implementation

T operator [](int index) {
  var initialIndex = index;
  for (var i = 0; i < _lists.length; i++) {
    var list = _lists[i];
    if (index < list.length) {
      return list[index];
    }
    index -= list.length;
  }
  throw new RangeError.index(initialIndex, this, 'index', null, length);
}