withCurrentRoute method
- AppRoute currentRoute
Returns a copy of the app route state but with the given current route
The state of the app routes will be carried over to the new copy.
Implementation
AppRouteState withCurrentRoute(AppRoute currentRoute) {
final appRootRoute = AppRootRoute.forAppRoute(currentRoute);
FleetView? fleetView;
bool? fleetShowingDashboard;
if (currentRoute is FleetRoute) {
fleetView = currentRoute.view;
fleetShowingDashboard = currentRoute.showingDashboard;
currentRoute = AppRoute.fleet;
}
return AppRouteState(
appRoutes: {
...appRoutes,
if (appRootRoute != null) appRootRoute: currentRoute,
},
appRootRoute: appRootRoute ?? this.appRootRoute,
current: appRootRoute != null ? null : currentRoute,
fleetView: fleetView ?? this.fleetView,
fleetShowingDashboard:
fleetShowingDashboard ?? this.fleetShowingDashboard,
);
}