Home > Back-end >  How can I prevent the user from going backwards using getX in flutter
How can I prevent the user from going backwards using getX in flutter

Time:10-28

I want to prevent the user from going back to the login screen using getX

onPressed: () {
                  Get.to(() => HomeScreen());
                },

CodePudding user response:

To navigate to the next screen and don’t want to go back to the previous screen (for use in SplashScreens, login screens and etc.) we can use it like this,

Get.off(NewScreen())

To navigate to the next screen and cancel all previous routes (useful in shopping carts apps , polls, and tests) we can use it like this,

Get.offAll(NewScreen())

For more see this: https://medium.com/mindful-engineering/lets-getx-in-flutter-4eaff2826ac7

  • Related