On using context.push('/profile/check');
the builder
function isn't called and hence the Text("Check")
shows inside the AppScaffold
.
late final GoRouter router = GoRouter(
initialLocation: '/',
refreshListenable: appService,
navigatorKey: _rootNavigatorKey,
routes: <RouteBase>[
ShellRoute(
navigatorKey: _rootShellNavigatorKey,
builder: (BuildContext context, GoRouterState state, child) => AppScaffold(
child: child,
),
routes: [
GoRoute(
parentNavigatorKey: _rootShellNavigatorKey,
path: '/',
builder: (BuildContext context, GoRouterState state) {
return HomeScreen();
},
),
GoRoute(
parentNavigatorKey: _rootShellNavigatorKey,
path: '/profile',
builder: (BuildContext context, GoRouterState state) {
return ProfilePageView();
},
routes: [
ShellRoute(
builder: (context, state, child) {
print('builder function not being called');
return Text("hello world");
},
routes: [
GoRoute(
path: 'check',
builder: (BuildContext context, GoRouterState state) {
return Center(
child: Text("Check"),
);
},
),
GoRoute(
path: 'test',
builder: (BuildContext context, GoRouterState state) {
return Center(
child: Text("Test"),
);
},
),
],
),
],
),
],
),
],
);