0

I integrated phone login in my app but whenever I log in I have to wait for the OTP. how do I check in the Starting if the user is registered/logged-in? if yes then redirect it to the home page directly. or else to the phone login page.

i tried this code below but it is showing the error of an undefined class 'FirebaseUser'.

final FirebaseAuth _firebaseAuth = FirebaseAuth.instance;
  FirebaseUser user;


  void getCurrentUser() async{
    FirebaseUser _user = await _firebaseAuth.currentUser();
    setState(() {
      user = _user;
    });
  }

can anyone help it's a bit confusing for me

Frank van Puffelen
  • 499,950
  • 69
  • 739
  • 734
palak
  • 351
  • 3
  • 13

1 Answers1

1

FirebaseUser there is no such a class replace it with User

User _user = await _firebaseAuth.currentUser();