I want to check if data is uploaded successfully to firestore when the user click the save button and show toast or ask the user to try again if the document not update.
this is my code to update the document.
Future updateTechnical(Technical technical) async {
return await technicalsCollection.doc(technical.id).update({
"name": technical.name,
"address": technical.address,
"phoneNum": technical.phoneNum,
"tools": technical.tools,
});
}
And this is the save Button
ElevatedButton(
onPressed: () {
DatabaseService().updateTechnical(
Technical(
id: selectedTechnical.id,
name: nameController.text,
address: addressController.text,
phoneNum: phoneController.text,
tools: selected.join(','),
),
);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('Save '),
Icon(Icons.person_add),
],
),
),