switchRoute method

void switchRoute(
  1. String route
)

Switches the current route to the provided route by moving it from its previous position in the stack to the top or adding it to the top if it is not already present in the stack's history.

Implementation

void switchRoute(String route) {
  setState(() {
    if (_routeHistory.contains(route)) {
      _routeHistory.remove(route);
    }
    _routeHistory.add(route);
  });
  _notifyRouteChange();
}