I'm new to flutter... I'm trying to get the state of the currently loggedIn user and notify the listeners using firebase but I'm getting this error The expression doesn't evaluate to a function, so it can't be invoked. at the auth.currentUser but I don't understand why.
Below is my code.
_initialize() async{
SharedPreferences prefs = await SharedPreferences.getInstance();
bool loggedIn = prefs.getBool(LOGGED_IN) ?? false;
if(!loggedIn){
_status = Status.Unauthenticated;
}else{
await auth.currentUser().then((currentUser) async{
_user = currentUser;
_status = Status.Authenticated;
_userModel = await _userServices.getUserById(currentUser.uid);
});
}
notifyListeners();
}
}