getDocument method

  1. @override
FutureOr<JsonObject> getDocument({
  1. required String documentPath,
  2. String? changeRootName,
})
override

Implementation

@override
FutureOr<JsonObject> getDocument({
  required String documentPath,
  String? changeRootName,
}) async {
  final docPath = firestorePathUtils.absolutePathFromRelative(documentPath);

  var document = Document(name: docPath);
  try {
    document = await firestore.get(docPath);
  } on DetailedApiRequestError catch (error, _) {
    // Even if document is empty (returns 404) it still can have collections!
    if (error.status != 404) {
      rethrow;
    }
  }

  return _getDocumentJson(document: document, json: JsonObject());
}