csells / go_router

The purpose of the go_router for Flutter is to use declarative routes to reduce complexity, regardless of the platform you're targeting (mobile, web, desktop), handling deep linking from Android, iOS and the web while still allowing an easy-to-use developer experience.
https://gorouter.dev
441 stars 97 forks source link

Redirect from parent to root #233

Closed princestha closed 2 years ago

princestha commented 2 years ago

Hi, if I have a scenario something like this...

I have my routes with this structure:

So when a user first comes to /user -> I want this redirected to :uid (This is working, however, when I go back using the back button, it goes back to a blank page and shows the user widget. How can I avoid this and redirect to home when this path is hit?

Thank you

princestha commented 2 years ago

I am experimenting and I can see that I can get this done with the push function as it will just push it on the stack, but is there a way to use the go functionality and when going back after the go, to re-run the redirect function when its back to the user route path? Please let me know if this doesn't make sense.

Thank you

princestha commented 2 years ago

moving to https://github.com/csells/go_router/discussions/234