push method

void push(
  1. String path, {
  2. String? id,
})

Pushes a new page by path.

id is used to match listeners.

Process route middlewares before push.

Implementation

void push(String path, {String? id}) {
  final routeDefinition = _findRouteDefinition(path);

  _processMiddlewares(
    routeDefinition,
    (RouteDefinition routeDefinition) {
      final page =
          PageWrapper(routeDefinition, path, _nextRouteIndex, id: id);
      _pageStack.add(page);
      notifyListeners();
      _notifyPush(page);
    },
  );
}