AstryxResolvedTokenSet class

Every token name mapped to a concrete light value and a concrete dark value.

This is where Layer 1 hands off to Layer 2. Every var() reference has been followed and every evaluable colour function evaluated, so the values here are terminal strings — '#0064E0', '8px', '175ms' — not expressions. Turning those strings into Flutter values is AstryxThemeData's job, not this class's.

Resolution is eager and happens once, in AstryxResolvedTokenSet.resolve. There is no cascade in Flutter to defer it to, and a theme is resolved far less often than it is read.

Instances are immutable, hold two unmodifiable maps, and are cheap to compare: hashCode is computed once during construction, so the common updateShouldNotify path is an identity check followed at worst by an integer comparison.

{@tool snippet}

final tokens = AstryxResolvedTokenSet.resolve(myTheme);

tokens.value(AstryxColorToken.accent, AstryxThemeMode.light); // '#0064E0'
tokens.pair(AstryxSpacingToken.s4);                           // ('16px', '16px')

{@end-tool}

Annotations

Constructors

AstryxResolvedTokenSet({required Map<String, String> light, required Map<String, String> dark})
Creates a token set from two already-resolved maps.
AstryxResolvedTokenSet.resolve(AstryxDefinedTheme? theme)
Runs the engine over theme and captures both modes.
factory

Properties

dark Map<String, String>
Every token's dark-mode value, keyed by CSS custom property name.
final
hashCode int
The hash code for this object.
no setteroverride
isComplete bool
Whether this set carries every one of the 184 core Astryx tokens.
no setter
length int
The number of tokens in this set.
no setter
light Map<String, String>
Every token's light-mode value, keyed by CSS custom property name.
final
names Iterable<String>
The token names in this set.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

contains(String cssName) bool
Whether cssName is present in this set.
copyWith({Map<String, String>? light, Map<String, String>? dark}) AstryxResolvedTokenSet
Returns a copy with the given entries applied over one or both modes.
forMode(AstryxThemeMode mode) Map<String, String>
The map for mode.
maybeValue(AstryxToken token, AstryxThemeMode mode) String?
The value of token in mode, or null if it is not in this set.
maybeValueOf(String cssName, AstryxThemeMode mode) String?
The value of the token named cssName in mode, or null if absent.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pair(AstryxToken token) → (String, String)
Both halves of token, as a record.
pairOf(String cssName) → (String, String)
Both halves of the token named cssName.
toString() String
A string representation of this object.
override
value(AstryxToken token, AstryxThemeMode mode) String
The value of token in mode.
valueOf(String cssName, AstryxThemeMode mode) String
The value of the token named cssName in mode.

Operators

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

Static Properties

defaults AstryxResolvedTokenSet
The Astryx defaults, with no theme applied.
final