removeAllAndPush method
Removes all routes then pushes a new page by path.
id
is used to match listeners.
Process route middlewares before remove.
Implementation
void removeAllAndPush(String path, {String? id}) {
final routeDefinition = _findRouteDefinition(path);
_processMiddlewares(
routeDefinition,
(RouteDefinition routeDefinition) {
final page =
PageWrapper(routeDefinition, path, _nextRouteIndex, id: id);
_pageStack.clear();
_pageStack.add(page);
notifyListeners();
_notifyPush(page);
},
);
}