You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I agree that sub-routes (or sub-routers) would be great. Not sure I agree with this though. The primary reason I like this idea is that it allows for logic to be shared across sub-routes. This is more similar to the way most web routers work (eg. express, Django) which share application logic.
An example for authentication:
sailor.addRoutes([
// '/admin', '/admin/dashboard', and '/admin/users' are all// guarded against users who are not both logged in and an adminSailorRoute(
name:"/admin",
builder: (context, args, params) =>AdminLayout(),
routerGuards: [_isLoggedIn, _isAdmin],
subroutes: [
SailorRoute(
name:"/dashboard",
builder: (context, args, params) =>DashboardPage(),
),
SailorRoute(
name:"/users",
builder: (context, args, params) =>UsersPage(),
),
]
);
For a scenario where you have a master layout page that then contained child widgets, have a way to nest these to have deeper routes. For example:
Routes:
This would build the widgets such as:
The text was updated successfully, but these errors were encountered: