用户不工作。我没有在 Firebase 中上传集合
try {
FirebaseAuth.instance.createUserWithEmailAndPassword
(email: kEmail.text, password: kPassword.text)
.then((value) {
userCollection.doc(value.user.uid).set({
'userName': kUserName,
'email': kEmail,
'password': kPassword,
'uid': value.user.uid
});
});
} catch (err) {
print(err.toString());
}
答案 0 :(得分:1)
用户可以为空。所以先做空检查,比如
const context = canvas.getContext("2d")
context.beginPath()
context.arc(canvas.width/2, canvas.height/2, 30, 0, 2*Math.PI, false)
context.fillStyle = 'blue'
context.fill()
context.beginPath()
context.fillStyle = 'green' // I only moved this line up
context.fillRect(canvas.width/2, canvas.height/2, 100, 30)
context.fill()
或者一个简单的溶胶
try {
FirebaseAuth.instance
.createUserWithEmailAndPassword(
email: kEmail.text, password: kPassword.text)
.then((value) {
if(value!=null && value.user != null){
userCollection.doc(value.user.uid).set({
'userName': kUserName,
'email': kEmail,
'password': kPassword,
'uid': value.user.uid
});
}else{
throw Error();
}
});
} catch (err) {
print(err.toString);
}
答案 1 :(得分:-1)