I need to check if data was written successfuly to Firestore so if it was successful I need to show a popup showing data was written or if data wasn't written i need to show a popup showing task failed so should I use a future builder what is the way to do it
Every Firestore Operations are promises, so it has .then() and .catch() method to handle whether the task is successful or failure.
For example, you can do something like this.
firestoreInstance.collection("Users").document('123456').updateData({
"username" : 'white_devil'
}).then((result) {
print("Success!");
}).catch((error){
print("Error!")
});
Not only on updateData(), you can also use this case in setData(),add(),get(), getDocuments() and all operations which returns a promise.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With