RivaanRanawat / flutter-reddit-clone

174 stars 69 forks source link

After logged in it doesn't navigate to home screen : Problem exist after the third commit #7

Closed YonasAlem closed 1 year ago

YonasAlem commented 1 year ago

Hello Guys, you are doing greate.

in main.dart, I know line 40 "setState" is being called infinitely. and that why you removed it.

but there is another bug, let's say you are a new user and try to login with google, and then after you logged in you will not be navigate to HomeScreen automatically unless you use hot Reload or quit the app and run it again.

the "setState" is not good, so if there is another solution?

wilpar commented 1 year ago

This seems to be related to a mismatch between user state on firebase and on the app at startup.

wilpar commented 1 year ago

I bashed around at it for a few hours, and it seems current versions of firebase_auth react differently, which is why we were having the problem. It likely was OK in Rivaan's app because his pubspec references older versions of firebase_auth, firebase_core, etc. What a difference 6 months can make to a project!

Added a pull request to solve.

https://github.com/RivaanRanawat/flutter-reddit-clone/pull/8

wilpar commented 1 year ago

BTW, If all you're interested in is the authentication management, I've pulled it out into its own repo.

Love this setup, will be using it in all future projects!

https://github.com/wilpar/bulletproof

YonasAlem commented 1 year ago

Thanks man. it seems nice. I will check it out.

YonasAlem commented 1 year ago

I know this is out of the topic.

but, What if we have like multiple screens from onboard to home screen? for example, if it is phone auth, we may have onboard -> login view -> verify view -> user info input view -> home screen. your solution will handle if we have two choice either login screen or home screen.

if you have idea it would be appreciated.

wilpar commented 1 year ago

Just set the auth type in a state variable.

On Thu, 8 Jun 2023 at 14:11, Yonas Alemayehu @.***> wrote:

I know this is out of the topic.

but, What if we have like multiple screens from onboard to home screen? for example, if it is phone auth, we may have onboard -> login view -> verify view -> user info input view -> home screen. your solution will handle if we have two choice either login screen or home screen.

if you have idea it would be appreciated.

— Reply to this email directly, view it on GitHub https://github.com/RivaanRanawat/flutter-reddit-clone/issues/7#issuecomment-1583118422, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA42YZGBYK7XRWKLLABJIP3XKIIWVANCNFSM6AAAAAAURWJLX4 . You are receiving this because you commented.Message ID: @.***>