manyWithIDs method
Deletes multiple documents from Firestore by their type and a list of document IDs.
Implementation
Future<void> manyWithIDs(Type type, List<String> documentIDs, { String? subcollection }) async {
if (documentIDs.isEmpty) return;
if (documentIDs.length > 500) {
throw ArgumentError('Batch limit exceeded. Maximum 500 document IDs allowed.');
}
WriteBatch batch = FS.instance.batch();
for (String id in documentIDs) {
DocumentReference ref = FS.instance.collection(type.toString()).doc(id);
if (subcollection != null) {
ref = FS.instance.collection(type.toString()).doc(subcollection).collection(subcollection).doc(id);
}
batch.delete(ref);
}
return batch.commit();
}