I want to add some extra features after new user login with a google login in Flutter.so I need to know if a user is new or not . if the user is new then I want to add some user information. other wise navigate to another page.
So how can I check If the User is new or not?
2
Answers
The
User
object has ametadata
property, which has two properties:creationTime
andlastSignInTime
. When those are no more than a few milliseconds apart, the user was just created. If they’re further apart, the user was created in a previous session.FirebaseAuth User contains this data in metadata prop. I used the following chunk of code. You can change the number of seconds if you want.