Flutter - Firebase Firestore operation is not working

Viewed 30

I am having a problem. First of all my code:

FirebaseAuth _auth = FirebaseAuth.instance;
FirebaseFirestore _firestore = FirebaseFirestore.instance;

//...

final userCredential = await _auth.createUserWithEmailAndPassword(
  email: _emailController.text,
  password: _passwordController.text,
);
print(userCredential.user?.uid); // mdaAcc1rXTe1s7VeWR7zcu6t4XD2
_firestore.collection("Users").doc(userCredential.user?.uid).set({
  "ID": userCredential.user?.uid,
  "Email": _emailController.text,
  "Phone": _phoneController.text,
  "Name": _nameController.text,
  "Surname": _surnameController.text,
  "Photo": "https://firebasestorage.googleapis.com/v0/b/teen-software-stock-tracking.appspot.com/o/default.jpg?alt=media&token=0eec2e1f-2ccf-4bda-8664-3d3f018621b3",
  "Level": 0,
  "ProductRight": 10,
  "AddedProduct": 0,
  "AccountCreate": FullDate.toString(),
});

The Firebase Auth process is running and the user's account is opened, but the Firestore process is not. The document does not open.

Why could this be? How can I solve it? Thanks in advance for your help.

0 Answers
Related