Closed thewizard1983 closed 4 years ago
I don't think firebase will give you information about whether the logged in user is new or existing. But you can do one thing, checkout the snippet below and consider your user as new one or existing one. I will keep this issue open, so that if anyone else need this they will use this snippet
FirebaseAuth.instance.currentUser().then((FirebaseUser user){
Duration duration = user.metadata.creationTime.difference(DateTime.now());
if(duration.inMinutes < 10){
// Consider as new user
}
});
why would you want 2 different screens, I mean if the user is new then the user will enter the mobile number and then register with OTP and if the user is already registered then user will log in using OTP. why would you need different screens?
The first time, I need to ask also other data for user registration, not only the telephone number. The second time they login, I need only the telephone.
Firebase always gives the user the same "ID" its up-to you to store this id and keep referring to it for any operation. Hope that helps
closing this issue, feel free to re-open for more questions
I would like to create two different screens:
Is there the possibility to know is a user exists with flutter firebase library?