Lets say that there is a way to enter the same screen from different places:
home screen -> final screen
second screen -> final screen
third screen -> final screen
etc...
how can I know from which screen I entered from? Because I need to make my own back button (default back button doesn't reset the state of the previous screen, and the state needs to reset ) I can't seem to find the example for the problem.
Can you use if statement for that?
Also I'm using GetX package
Desired outcome:
home screen -> final screen (back button)-> home screen
second screen -> final screen (back button)-> second screen
third screen -> final screen (back button)-> third screen
CodePudding user response:
The get package allows Get.back() to navigate back to the screen from where the final screen was opened.
CodePudding user response:
Navigating from homeScreen to final Screen
//using route
Get.toNamed('/finalScreen');
//or
Get.to(() => FinalScreen());
Use Get.back();
to you navigate to homeScreen
Same in other cases