【发布时间】:2021-08-27 16:32:29
【问题描述】:
我正在开发一个带有颤振和 firebase 的应用程序,我正在为用户进行身份验证,我希望你使用函数 uid 但它不起作用,为什么?
import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_database/firebase_database.dart';
class FirebaseHelper {
//Authentification
final auth = FirebaseAuth.instance;
Future<UserCredential> handleSignIn(String mail, String password) async{
final UserCredential user = await auth.signInWithEmailAndPassword(email: mail, password: password);
return user;
}
Future<UserCredential> handleCreate(String mail, String password, String prenom, String nom) async{
final UserCredential user = await FirebaseAuth.instance.createUserWithEmailAndPassword(email: mail, password: password);
String uid = user.uid;
Map<String, String> map = {
"prenom" : prenom,
"nom" : nom,
};
addUser(uid, map);
return user;
}
//database
static final base = FirebaseDatabase.instance.reference();
// ignore: non_constant_identifier_names
final base_user = base.child("users");
addUser(String id, Map map){
base_user.child(uid).set(map);
}
}
这是标记The getter 'uid' isn't defined for the type 'UserCredential'. 和Undefined name 'uid'. 我不知道我能做什么...请帮助我
【问题讨论】:
标签: firebase flutter dart firebase-authentication