-
I Decided to use this pkg for my next big project, and I have couple of questions. I appreciate any feedback given.
What I'm trying to achieve:
I made it work, but I feed like I'm not doing thing the right way, especially in the '/' GoRoute. file: root_screen.dart
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
I'm curious why you don't think you did |
Beta Was this translation helpful? Give feedback.
-
You can put all of your auth redirection logic into your top-level redirect function. In fact, it's already there. Your root route can just always forward: GoRoute(
name: 'root',
path: '/',
redirect: (_) => '/home/feed',
), Your top-level and route-level redirect functions will keep being called until |
Beta Was this translation helpful? Give feedback.
You can put all of your auth redirection logic into your top-level redirect function. In fact, it's already there. Your root route can just always forward:
Your top-level and route-level redirect functions will keep being called until
null
is returned. In the case that the user is authenticated and headed to/home/feed
, then your top-level redirect will returnnull
and they're head to/home/feed
as planned. If they're not authenticated, they'll have to authenticate first before they head to/home/feed
. I believe that's the behavior you're after, correct?