Flutter: How to prevent automatic navigation to Home Page when signing up users?

522 views Asked by At

I have a Stream that listens to authStateChanges from Firebase. This determines on the root page whether to show the user the Landing Page or the Home Page. Currently, the navigation flow that I have envisioned is something like: App Flow

Where, if the user Stream is not a null value, it will return the Home Page and there is nothing in the Stream it will go to the Landing Page. My question revolves around the navigation between the Sign Up Page and the Complete Sign Up Page. With the Firebase, the email/password sign up process automatically registers the user in firebase and then logs them in. Can I just use a regular named route to go from the Sign Up Page to the Complete Sign Up page, even though the Stream would have an auth state change when registering the user?

Conceptually, I think the Stream would automatically take the user from the Sign Up Page to the Home Page, and skip the Complete Sign Up Page, even with a router. Am I missing something?

Additional info: Currently the authStateChanges listen to User uid only, eventually I want to incorprate email verification when signing up with email/password.

1

There are 1 answers

1
ElsayedDev On

In your MaterialApp , make its child a StreamBuilder with your codition if snapshot.data.isAuth return HomePage() , else return SignupPage()