I have an app with 2 screens:
The routes are configured like this:
AutoRoute(
path: '/merchants',
name: 'MerchantsRoute',
page: EmptyRouterPage,
guards: [AuthGuard],
children: [
AutoRoute(path: '', page: MerchantsView, guards: [AuthGuard], initial: true),
AutoRoute(
path: ':id',
page: SingleMerchantView,
guards: [AuthGuard],
children: [
AutoRoute(path: 'dashboard', page: Dashboard, guards: [AuthGuard], name: 'MerchantDashboardRoute'),
AutoRoute(path: 'purchases', page: PurchasesList, guards: [AuthGuard], name: 'MerchantPurchasesRoute'),
AutoRoute(path: 'profile', page: PurchasesList, guards: [AuthGuard], name: 'MerchantProfileRoute'),
]
),
]
),
SinglMerchantView is the widget containing the AutoTabsScaffold and the TabBarView
Using flutter web, when I access directly (by typing directly the url in chrome) to:
Any idea on how to fix this?
My understanding is that you need an EmptyRouterPage for each of the nestles. Something similar to this:
AutoRoute(
path: '/merchants',
name: 'MerchantsRoute',
page: EmptyRouterPage,
guards: [AuthGuard],
children: [
AutoRoute(path: '', page: MerchantsView, guards: [AuthGuard], initial: true),
AutoRoute(
name: 'SingleMerchantRouter',
path: ':id',
page: EmptyRouterPage,
guards: [AuthGuard],
children: [
AutoRoute(path: '', page: SingleMerchantView, guards: [AuthGuard]),
AutoRoute(path: 'dashboard', page: Dashboard, guards: [AuthGuard], name: 'MerchantDashboardRoute'),
AutoRoute(path: 'purchases', page: PurchasesList, guards: [AuthGuard], name: 'MerchantPurchasesRoute'),
AutoRoute(path: 'profile', page: PurchasesList, guards: [AuthGuard], name: 'MerchantProfileRoute'),
]
),
]
),
I haven't been able to test, but it is similar to an issue I had today.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With