all method
Deletes all documents of a specific type from Firestore.
Implementation
@override
Future<void> all(Type type, { required bool iAmSure, String? subcollection }) async {
if (iAmSure) {
Map<String, dynamic>? snapshot;
if (subcollection == null) {
snapshot = await LS.instance.collection(type.toString()).get();
}
else {
snapshot =
await LS.instance.collection(type.toString()).doc(subcollection)
.collection(subcollection)
.get();
}
if (snapshot == null) return Future.value();
if (snapshot.isEmpty) return Future.value();
List<Future> futures = [];
for (var entry in snapshot.entries) {
futures.add(LS.instance.collection(type.toString()).doc(entry.key.split("/")[2]).delete());
}
await Future.wait(futures);
}
}