getx
getx copied to clipboard
hardware back button in example_nav2 will turn off an app
Describe the bug go to another screen with function toNamed then tap on the back button hardware in android, an app does not go back screen before, it turns off.
**Reproduction code try in example_nav2
Getx Version: ^5.0.0-beta.51
Hi, I had the same problem as you reported. But I realized that it was an error when implementing the routes in the application Example: I have this code in my application
GetPage(
name: /home,
page: () => const HomePage(),
),
GetPage(
name: /homedetails,
page: () => const HomeDetails(),
),
Se voce tentar navegar apartir da home para homedetails, na hora de voltar com o botao fisico ele voltaria para sua rota inicial '/'
Get.rootDelegate.toNamed( '/homedetails');
For your app to work, you need to tweak a few things that worked for me. So I believe it must be correct.
GetPage(
name: /home,
page: () => const HomePage(),
children:[
GetPage(
name: /homedetails,
page: () => const HomeDetails(),
),
] ),
For navigation:
Get.rootDelegate.toNamed( '/home/homedetails');