deleteData method
Implementation
Future<void> deleteData({
required String collection,
required String id,
FileModel? photo,
bool isErrorDialog = true,
Function(String? message)? onError,
}) async {
// try {
return await _firestore
.collection(collection)
.doc(id)
.delete()
.then((_) async {
if (photo != null) {
await StorageService().deleteFile(photo.filename!,
fileType: photo.type!, folder: photo.folder!);
}
}).catchError((error) async {
if (isErrorDialog) {
GetxFire.openDialog.messageError(error.toString());
} else {
await GetxFire.hideProgressHud();
}
if (onError != null) onError(error);
return null;
});
// } catch (e) {
// GetxFire.openDialog.messageError(e.toString());
// rethrow;
// }
}