push method

  1. @override
void push(
  1. Uri uri, [
  2. Object? state
])
override

Pushes a new history entry.

The optional state is stored on the entry and can be read back via location's RouteInformation.state.

Implementation

@override
void push(Uri uri, [Object? state]) {
  action = .push;
  index = (this.state?.index ?? 0) + 1;
  final historyState = _HistoryState(
    userData: state,
    index: index,
    identifier: generateIdentifier(),
  );

  window.history.pushState(
    historyState.toJson().jsify(),
    '',
    createHref(uri),
  );
}