deleteDocument method

Future<bool> deleteDocument(
  1. List<String> paths
)

Deletes existing document from Firebase.

paths is the list of paths to the document. For example: myCollection, documentId which will be constructed to myCollection/documentId.

Implementation

Future<bool> deleteDocument(List<String> paths) async {
  final pathToDocument = getPathToDocument(paths);

  try {
    await _firebaseFirestore.doc(pathToDocument).delete();
    _loggingService.log('FirestoreHelper.deleteDocument: Deleted. Path: $pathToDocument');
    return true;
  } catch (e, s) {
    _loggingService.log(
      'FirestoreHelper.deleteDocument: Path: $pathToDocument, Exception: $e. StackTrace: $s',
      logType: LogType.error,
    );
    return false;
  }
}