go method

  1. @override
Future<Null> go (int n)
override

Travel n entries forward or backward on the History list

The direction of travel is determined by the sign of n and the next entry is determined relative to the current entry.

h.go(0); // This has no effect
h.go(1); // Travel to the next entry on the list
h.go(-1); // Travel to the previous entry on the list

NOTE: The destination entry is calculated by clamping on the bounds of the list:

// When there is only 1 previous entry on the list,
// The following is logically equivalent
h.go(-1);
h.go(-100);

// When there is only 1 next entry on the list
// The following is logically equivalent
h.go(1);
h.go(100);

Implementation

@override
Future<Null> go(int n) async {
  if (_transitionManager.listeningToWindowEvents) {
    _popHandlerCompleter = Completer();
    _globalHistory.go(n);
    await _popHandlerCompleter.future;
    _popHandlerCompleter = null;
  } else {
    _globalHistory.go(n);
    await _handlePop(_domLocation(_historyState));
  }
}