getRevisionByTag method

Future<Revision?> getRevisionByTag(
  1. String tag
)

Gets a revision by tag.

Resolves the tag server-side via the ResolveKref RPC, mirroring Python's get_revision_by_tag. Returns null if no revision carries the tag (NOT_FOUND).

final approved = await item.getRevisionByTag('approved');

Implementation

Future<Revision?> getRevisionByTag(String tag) async {
  try {
    final response = await client.resolveKref(kref.uri, tag: tag);
    return Revision(response, client);
  } on GrpcError catch (e) {
    if (e.code == StatusCode.notFound) {
      return null;
    }
    rethrow;
  }
}