Flutter – Firebase Firestore operation is not working

Issue

This Content is from Stack Overflow. Question asked by Emir Bolat

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,
);
inspect(userCredential.user?.uid);
_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.



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?