Reputation: 365
I need to update this code, not I'm not sure how. Does anyone have a clue?
_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();
}
Upvotes: 1
Views: 39
Reputation: 1051
"currentUser" is not a method anymore, it's a property.
_initialize() async{
SharedPreferences prefs = await SharedPreferences.getInstance();
bool loggedIn = prefs.getBool(LOGGED_IN) ?? false;
if(!loggedIn){
_status = Status.Unauthenticated;
}else{
_user = auth.currentUser;
_status = Status.Authenticated;
_userModel = await _userServices.getUserById(_user.uid);
}
notifyListeners();
}
Upvotes: 1