0
I’m trying to do a Dart/Flutter check/validation in the Firebase Firestore database to not save the same serial number string twice in the database, but I’m doing something wrong because it keeps saving the same field and value even though it’s the same.
Code
var numero = Firestore.instance.collection("lockers").document().snapshots();
if (numero == "$_numeroSerie"){
print("QR Code ja cadastrado");
} else {
await Firestore.instance
.collection("lockers")
.document()
.setData({"numero_serie": _numeroSerie});
}