firebase 当前用户:表达式的计算结果不是函数,因此无法调用它

f4t66c6m  于 2022-12-30  发布在  其他
关注(0)|答案(1)|浏览(119)

我需要更新这个代码,我不知道怎么做。有人知道吗?

_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();

}

ijxebb2r

ijxebb2r1#

“currentUser”不再是方法,而是属性。

_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();
}

相关问题