Home > Net >  Using Getx Navigation Go from Homepage-> product page -> Product details page -> homepage w
Using Getx Navigation Go from Homepage-> product page -> Product details page -> homepage w

Time:01-05

If the user clicks on back from homepage, he should go to product details page.

When I am using Get.tonamed(Routes.Home) , Getx is creating a new instance of homepage.

CodePudding user response:

Use Get.ofAll(Home()); to avoid creating new instance of HomePage this will remove all the stacked pages in the Navigation Stack

CodePudding user response:

You need to pop/Back screens till home page from Navigation stack instead of adding it again in navigation stack.In your current code you are again adding home page in Navigation stack from product details page.

so you need to use offAll or offNamedUntil avoid new instance of home page you need pop/back screen until home screen.avoid

It will remove all previous pages from navigation stack.

Get.offAll(Home()); 

 //  OR. //

Get.offNamedUntil('home', (route) => false); // RouteName

For more information checkout this link

Official package check Readme Route management link

  • Related