ContentKey class

Content-addressed identity of a stored artifact (ADR-0013).

A key is a plain value: category groups related artifacts (androidx, maven, kotlin-compiler, …), name distinguishes artifacts inside a category, version is the upstream version, and contentHash ties the key to the inputs that produced it (see ContentKey.compute). platform scopes artifacts whose bytes differ per platform; it is part of key identity and of the on-disk path.

toString is human-decodable and equals relativePath — the store layout mirrors it one-to-one, e.g. aapt2/aapt2/8.0.2-3f9d2c1a8b77/linux.

Annotations
  • @immutable

Constructors

ContentKey({required String category, required String name, required String version, required String contentHash, String platform = 'any', String? fileName})
const
ContentKey.compute({required String category, required String name, required String version, required List<String> inputs, String platform = 'any', String? fileName})
Derives the content hash from inputs (full sha256 hex).
factory

Properties

category → String
Group of related artifacts, e.g. 'androidx', 'maven', 'tools'.
final
contentHash → String
Content hash (sha256 hex) binding the key to its producing inputs.
final
dirName → String
Directory name under <category>/<name>/: <version>-<hash>.
no setter
fileName → String?
File name used inside the store directory; defaults to name. Not an identity field: the same content under a different file name is the same artifact.
final
fileNameOrDefault → String
File name materialized inside the store directory.
no setter
hashCode → int
Hash over all key fields (equality is field-wise).
no setteroverride
id → String
Stable store identifier.
no setter
name → String
Artifact name inside the category, e.g. 'annotation'.
final
platform → String
Platform the artifact is for ('linux', 'jvm', 'any', …).
final
relativePath → String
Store-relative directory path — also the toString form, so oka cache why output and ls output agree character for character.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
shortHash → String
First 12 hex chars of contentHash — the human-decodable form used in directory names and printed keys.
no setter
version → String
Upstream version string, e.g. '1.9.1'.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
Debug string: the store-relative path (same as id).
override

Operators

operator ==(Object other) → bool
The equality operator.
override