getLatestRevision method

Future<RevisionResponse> getLatestRevision(
  1. String itemKref
)
inherited

Gets the latest revision for an item.

Convenience method that resolves to the revision with the 'latest' tag.

Implementation

Future<RevisionResponse> getLatestRevision(String itemKref) async {
  final revisions = await getRevisions(itemKref);
  if (revisions.isEmpty) {
    throw Exception('No revisions found');
  }
  return revisions.firstWhere(
    (revision) => revision.latest,
    orElse: () => revisions.first,
  );
}