【发布时间】:2020-09-10 21:05:35
【问题描述】:
我想更改用户个人资料(用户名和照片)。但它给出了错误没有为类“FirebaseAuth”定义方法“updateProfile”。这是代码
onPressed: (){
var createUserWithEmailAndPassword = FirebaseAuth.instance.
createUserWithEmailAndPassword(
email: _email,
password: _password);
createUserWithEmailAndPassword.then((signedInUser){
var userUpdateInfo = new UserUpdateInfo();
userUpdateInfo.displayName = _userName;
userUpdateInfo.photoUrl='https://www.google.com/url?sa=i&url=https%3A%2F%2Forangefootballclub.com%2Fen%2Farticles%2Fcristiano-ronaldo-says-will-fight-to-win-champions-league-for-juventus%2F&psig=AOvVaw3W_YulXC1W9I_Hpf0njprF&ust=1590379669136000&source=images&cd=vfe&ved=0CAIQjRxqFwoTCOj-3ZDQy-kCFQAAAAAdAAAAABAJ';
FirebaseAuth.instance.updateProfile(userUpdateInfo).
then((user){
FirebaseAuth.instance.currentUser().then((user){
UserManagement().storeNewUser(signedInUser.user, context);
}).catchError((e){
print(e);
});
}).catchError((e){
print(e);
});
}).catchError((e){
print(e.toString());
});
},
请告诉我纠正此代码的方法
【问题讨论】:
-
抱歉,我的回答似乎有些错误,现在可以了吗?
标签: firebase flutter dart firebase-authentication user-profile