我如何在注册时(使用createuserwithemailandpassword)将用户照片和用户名设置为user.uid。我想在注册时接受用户的照片和用户名,在使用createuserwithemailandpassword功能注册iam时如何将它们添加到firebase?创建帐户,我认为我们应该使用user.updateInfo函数,但是我不清楚,请有人帮助我,我被打中了
import 'package:firebase_auth/firebase_auth.dart';
abstract class BaseAuth {
Future<String> signinwithemailandpassword(String mail,String password);
Future<String> createuseraaccount(String mail,String password);
Future<String> currentuserstate();
Future<void> onsignout();
Future<String> getuseremail();
}
class Auth implements BaseAuth{
Future<String> signinwithemailandpassword(String mail,String passworrd) async{
FirebaseUser user=await FirebaseAuth.instance.signInWithEmailAndPassword(email: mail,password: password);
return user.uid;
}
Future<String> createuseraaccount(String mail,String password) async{
FirebaseUser user=await FirebaseAuth.instance.createUserWithEmailAndPassword(email: mail,password: password);
return user.uid;
}
Future<String> currentuserstate() async{
FirebaseUser user=await FirebaseAuth.instance.currentUser();
return user.uid;
}
Future<void> onsignout() async{
FirebaseAuth.instance.signOut();
}
Future<String> getuseremail() async{
FirebaseUser user= await FirebaseAuth.instance.currentUser();
String email= user.email;
return email;
}
}