operator [] method

  1. @override
E operator [](
  1. int index
)

The object at the given index in the list.

The index must be a valid index of this list, which means that index must be non-negative and less than length.

Implementation

@override
E operator [](int index) {
  print("operator $index  $_last");
  if (_last == index) return _l[index];
  if (_last >= 0 && _last < _l.length) {
    var lastPage = _l[_last];
    if (lastPage is PageLifecycle) {
      (lastPage as PageLifecycle).onPause();
      _RouterStack.instance._convertTo(lastPage)?.onPause();
    }
  }
  var indexPage = _l[index];
  if (indexPage is PageLifecycle) {
    (indexPage as PageLifecycle).onResume();
    _RouterStack.instance._convertTo(indexPage)?.onResume();
  }
  _last = index;
  return _l[index];
}