Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App only closes on the first screen #9

Closed
MustafaAdam opened this issue Jul 21, 2020 · 1 comment
Closed

App only closes on the first screen #9

MustafaAdam opened this issue Jul 21, 2020 · 1 comment

Comments

@MustafaAdam
Copy link

I am pushing routes with Navigator to navigate between screens.
I have written the package code in my third route.
When I double back button press on the third route, it only takes me to my second route.
It only works on the first route.

Am I doing something wrong?

@ghost
Copy link

ghost commented Jul 21, 2020

Although the name of the package is double_back_to_close_app, it actually provides a way to "double back to close the current route", so I'm not surprised about the experience you faced.

There's no way to safely close the app when you are not on the initial route, as you can see here. Therefore, the library behavior is correct.

Removing the previous routes may help you achieve what you want, though. Since you are not allowing the user to return to the previous route, it doesn't make any difference. So, instead of simply pushing the third route, consider these other methods:

  • Navigator.pushAndRemoveUntil()
  • Navigator.pushReplacement()
  • Navigator.removeRouteBelow()

I'm closing this for now, but feel free to open it again if my answer doesn't satisfy you :)

@ghost ghost closed this as completed Jul 21, 2020
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant