get method

  1. @override
Future<Artifact> get(
  1. String id
)
inherited

Implementation

@override
Future<T> get(String id) async {
  final parent =
      collectionParentPath.isEmpty
          ? documentsPath
          : '$documentsPath/$collectionParentPath';
  final documentPath = '$parent/$collectionId/$id';
  late Document document;
  try {
    document = await _firestore.projects.databases.documents.get(
      documentPath,
    );
    return _fromFirestore(document);
  } catch (e) {
    if (e is DetailedApiRequestError && e.status == 404) {
      throw RepositoryException(
        message: 'Item with id $id not found',
        code: RepositoryErrorCode.notFound,
      );
    }
    rethrow;
  }
}