I have a an app built around a StreamBuilder
listening for FirebaseAuth.instance.onAuthStateChanged
return new StreamBuilder<FirebaseUser>(
stream: FirebaseAuth.instance.onAuthStateChanged,
builder: (BuildContext context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) { ...
I'm trying to reload the user and use onAuthStateChanged to pick up when an email is verified. User.reload() is insufficient with the StreamBuilder
. It's a similar issue to this onAuthStateChanged doesn't get called when email is verified in flutter
I thought a solution would be to force a logout and login but I'm at a loss on how to do that - e.g. step 2, login again to trigger onAuthStateChanged.
_auth.signOut(); //sign out and immediate sign in
final FirebaseUser user = await _auth.signIn----( //which signin function?