all method

  1. @override
Future<void> all(
  1. Type type, {
  2. required bool iAmSure,
  3. String? subcollection,
})
override

Deletes all documents of a specific type from Firestore.

Implementation

@override
Future<void> all(Type type, { required bool iAmSure, String? subcollection }) async {
  if (iAmSure) {
    final String? className = LS.classNames[type];
    if (className == null) {
      throw UnsupportedError('No class name found for type: $type. Consider re-generating Firestorm data classes.');
    }

    if (subcollection == null) {
      await LS.instance.collection(className).delete();
    }
    else {
      final collectionRef = LS.instance.collection(className).doc(subcollection).collection(subcollection);
      await collectionRef.delete();
    }
  }
}