[Question] Redirect from parent to root #234
-
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 --- 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? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
@princestha You probably want something like this: GoRoute(path: '/user', redirect: (_) => '/user/default_user_id'),
GoRoute(path: '/user/:uid', builder: (c,s) => UserDetailsScreen(uid: s.params['uid'])), Does that make sense? |
Beta Was this translation helpful? Give feedback.
@princestha You probably want something like this:
Does that make sense?