Wednesday 27 July 2022

Flutter Navigation Without Context

 In Flutter navigation without context between two screens is very easy with the help of Getx package. For more info about Get Package, click here to read our article.

In this blog, you will learn how to navigate one screen to another screen without context. So Let’s get started.

flutter navigation  without context using getx
flutter navigation without context using getx

In the old method we use Navigator. Now we don’t need any lengthy code.

Flutter Navigation without Context

Navigate to a new screen:

Get.to(NextScreen());

To close snackbars, dialogs, bottomsheets, 

Get.back();

This method is used to go to the next screen and remove the previous screen. This method is helpful when we use SplashScreens, login screens and etc.

Get.off(NextScreen());

This method is used to go to the next screen and remove all previous routes. This method is useful when we use shopping carts, polls, and tests, etc.

Get.offAll(NextScreen());