Closed dannnnthemannnn closed 4 years ago
@dannnnthemannnn Thank you for your interest in the repository.
Yes, the firebase auth definitely calls the _onAuthStateChanged listener each time app loads in order to check whether or not the user is already logged in. This is why it works.
Do you have any issue, that you are stuck on splash screen? This might sometime happen if internet connection is slow or not properly working and the firebase_auth is taking long time to validate whether or not the user is already logged in.
Closed due to inactivity!
@dannnnthemannnn Thank you for your interest in the repository.
Yes, the firebase auth definitely calls the _onAuthStateChanged listener each time app loads in order to check whether or not the user is already logged in. This is why it works.
Do you have any issue, that you are stuck on splash screen? This might sometime happen if internet connection is slow or not properly working and the firebase_auth is taking long time to validate whether or not the user is already logged in.
The part I don't understand is where is the User object being passed to the _onAuthStateChanged function (which takes a User object?
I'm also trying to get my head around the syntax of the following:
UserRepository.instance(this.pnService) : _auth = FirebaseAuth.instance, _googleSignIn = GoogleSignIn(scopes: ['email']) { _error = ''; _loading = true; _auth.authStateChanges().listen(_onAuthStateChanged); }
in particular is this a constructor? Ive never seen one organised like this and I'm unsure of the : semicolon followed by two variables and then a function body? Any pointers would be very handy as I have working code but these two parts I don't fully understand.
Hi,
I like this starter! Trying to understand the logic around user sign in. Currently it looks like the only time the user status is set to unauthenticated during initial app launch (instead of uninitialized) is here (https://github.com/lohanidamodar/flutter_firebase_starter/blob/3250f4457718af77c72938b7855e226163586b00/lib/features/auth/data/model/user_repository.dart#L110).
This runs inside as a result of _auth.onAuthStateChanged.listen(_onAuthStateChanged);
It seems like if this does not trigger an initial call to _onAuthStateChanged, the app will just sit at the splash screen because it is still uninitialized. Is this correct and is there any guarantee that it will call _onAuthStateChanged to start out?