~~Get.to(CounterPage()));~~
Get.to(()=> CounterPage());
Get.back();
Get.off(CounterPage()); // popUntil
Get.off(() => CounterPage()); // popUntil
Get.offAll(CounterPage()); // popAll
공식 페이지에서는 Get.to(Component())
형식으로 사용하라고 되어 있는데,
실제 사용시 아래와 같이 Get.to(() => Component())
형식으로 사용하라고 Warning 발생한다.
GetMaterialApp
level에서 이름을 지정해 Named로 Routing 할 수 있음
Get.toNamed('/counterPage');
Get.toNamed('/counterPage', arguments: 'Get is the best');
Get.offNamed('/counterPage');
Get.offAllNamed("/counterPage");
void main() {
runApp(
GetMaterialApp(
unknownRoute: GetPage(name: '/notfound', page: () => UnknownRoutePage()),
initialRoute: '/',
getPages: [
GetPage(name: '/', page: () => MyHomePage()),
GetPage(
name: '/third',
page: () => Third(),
transition: Transition.zoom
),
],
)
);
}
Get.offAllNamed('/counterPage?name=Enzo')
print(Get.parameters['name']); // out: Enzo
------------
Getpage(
name: '/profile/:user',
page: () => UserProfile(),
)
Get.toNamed('/profile/34954');
print(Get.parameters['user']); // out: 35954