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