auto_route_library
auto_route_library copied to clipboard
On Clicking Browswer Reload, it auto redirect to parent route or initital child route (if defined)
I have defined the auto route as below.
@MaterialAutoRouter(
replaceInRouteName: 'Page,Route',
routes: <AutoRoute>[
CustomRoute(
page: HomePage,
path: '/',
initial: true,
transitionsBuilder: TransitionsBuilders.fadeIn),
CustomRoute(
path: '/admin',
page: AdminLayoutPage,
children: [
CustomRoute(
page: DashboardPage,
path: 'dashboard',
// initial: true,
transitionsBuilder: TransitionsBuilders.fadeIn),
CustomRoute(
page: GazetteerPage,
path: 'gazetteer',
transitionsBuilder: TransitionsBuilders.fadeIn),
],
],
)
// extend the generated private router
class AppRouter extends _$AppRouter {
AppRouter({required AuthGuard authGuard}) : super(authGuard: authGuard);
}
when I am on page GazetteerPage. I try to reload the page (broswer reload button) or enter with current url. I expect it stay on the admin/gazetter, but no it goes to /admin.
Another case, if i define initial: true on DashboardPage. then it redirect to Dashboardpage even I reload on Gazetterr page.
How can I prevent this behavoir.
Note: let say, if I type /admin/gazetter, if I dont stay on GazetteerPage. it will go to gazetter page with no issue. but when I stay on that page and try to reload page. it redirect to admin or initial page of Admin.