Slide 168
Slide 168 text
%
164
final goRouter = GoRouter(
initialLocation: '/',
observers: [
appLifecycleObserver,
],
routes: [
GoRoute(
path: '/',
pageBuilder: (context, state) {
return MaterialPage(
key: state.pageKey,
name: '/',
child: const MyHomePage(),
);
},
),
GoRoute(
path: '/page1',
pageBuilder: (context, state) {
return MaterialPage(
key: state.pageKey,
name: 'page1',
child: const Page1(),
);
},
),
GoRoute(
path: '/page2',
pageBuilder: (context, state) {
return MaterialPage(
key: state.pageKey,
name: 'page2',
child: const Page2(),
);
},
),
],
);
利用側