oneWithID method

  1. @override
Future<void> oneWithID(
  1. Type type,
  2. String documentID, {
  3. String? subcollection,
})
override

Deletes a document from Firestore by its type and document ID.

Implementation

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

  DocumentRef ref = LS.instance.collection(className).doc(documentID);
  if (subcollection != null) {
    ref = LS.instance.collection(className).doc(subcollection).collection(subcollection).doc(documentID);
  }
  return ref.delete();
}