是否有任何功能可以在 flutter 中添加/更新 firebase 用户名和照片 url?

Muh*_*zan 7 dart firebase firebase-authentication flutter

有没有办法像我们UserProfileChangeRqeust()在原生 Android 中一样在 flutter 中添加/更新 firebase 用户名和照片 url?

Ayu*_*har 6

就在这里。

收到后FirebaseUser,您可以调用updateProfile()对象上的方法来提供新的详细信息。该方法将采用 type 的输入UserUpdateInfo

例如,

FirebaseUser user = await _auth.currentUser();

UserUpdateInfo userUpdateInfo = UserUpdateInfo();

userUpdateInfo.displayName = 'Ayush';
userUpdateInfo.photoUrl = '<my photo url>';

await user.updateProfile(userUpdateInfo);
Run Code Online (Sandbox Code Playgroud)

  • UserUpdateInfo 在最新版本的 Firebase Auth 中已弃用。请更新答案。 (2认同)