deleteSubCollectionDocument method

Future<bool> deleteSubCollectionDocument({
  1. required String collection,
  2. required String documentId,
  3. required String subCollection,
  4. required String subCollectionDocumentId,
})

Implementation

Future<bool> deleteSubCollectionDocument({
  required String collection,
  required String documentId,
  required String subCollection,
  required String subCollectionDocumentId,
}) async {
  try {
    _loggingService.log('FirestoreGenericService.deleteDocument: Deleting. Collection $collection, DocId: $documentId'
        ' SubCollection $subCollection, SubCollectionDocId: $subCollectionDocumentId');
    await _firebaseFirestore
        .collection(collection)
        .doc(documentId)
        .collection(subCollection)
        .doc(subCollectionDocumentId)
        .delete();
    _loggingService.log('FirestoreGenericService.deleteDocument: Deleted. Collection $collection, DocId: $documentId');
    return true;
  } catch (e) {
    _loggingService.log(
      'FirestoreGenericService.deleteDocument: Exception: $e',
      logType: LogType.error,
    );
    return false;
  }
}