bulkDelete method
delete more one document model call bulkDelete
delete specific models use bulkDelete by pass docsIds
FirestoreModel.use
Implementation
Future<void> bulkDelete({
List<String>? docsIds,
Query query(Query query)?,
}) async {
if (query != null) {
WriteBatch batch = FirebaseFirestore.instance.batch();
return this.get(queryBuilder: query).then((models) {
models?.forEach((model) {
batch.delete(_collectionReference.doc(model?.docId));
});
batch.commit();
});
}
if (docsIds != null) {
WriteBatch batch = FirebaseFirestore.instance.batch();
docsIds.forEach((docId) {
batch.delete(_collectionReference.doc(docId));
});
batch.commit();
}
}