ThemeIntent class final

Steering hints for generated themes. Every field is optional; an empty intent means an ordinary unsteered theme.

Immutable, with value equality. Build one in code, or from model output with ThemeIntent.parse / ThemeIntent.fromJson.

Annotations

Constructors

ThemeIntent({Iterable<ThemeFamily> families = const [], ThemeBrightness? brightness, Iterable<IntentColor> colors = const [], IntentChroma? chroma, HarmonyScheme? harmony, (int, int)? hueRange, String? name})
An intent. Lists are de-duplicated and capped; disabled families are dropped; name is trimmed to maxNameWords words.
ThemeIntent.fromJson(Object? json)
Lenient: never throws. See parseJson for what was dropped.
factory

Properties

brightness → ThemeBrightness?
Light or dark; null for either.
final
chroma → IntentChroma?
How colourful; null for the family's usual range.
final
colors → List<IntentColor>
Up to maxColors colours. The first picks the base hue; with no harmony, the second and third pick the operator and = hues.
final
effectiveBrightness → ThemeBrightness?
brightness, or the lean of the first colour that has one.
no setter
effectiveChroma → IntentChroma?
chroma, or the lean of the first colour that has one.
no setter
families → List<ThemeFamily>
Families to draw from (empty: let the feed choose).
final
forEntry → ThemeIntent
The part of this intent that shapes one generated theme: everything but families (the feed's business). Feed entries store this.
no setter
forSpec → ThemeIntent
forEntry without name (the spec stores its name itself). Specs and share codes store this.
no setter
harmony → HarmonyScheme?
Colour harmony; null for the family's usual mix.
final
hashCode → int
The hash code for this object.
no setteroverride
hueRange → (int, int)?
A precise base hue range in degrees (from, to), clockwise, wrapping past 360. Wins over the first colour for the base hue. Not part of the model vocabulary.
final
isEmpty → bool
Whether this intent changes anything at all.
no setter
name → String?
The theme's display name (at most maxNameWords words); null for a generated name.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
steersColour → bool
Whether this intent changes how themes are generated (anything but families and name).
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reportFor(ThemeFamily family) → List<IntentNote>
The hints family cannot honour (empty when it honours them all), at the newest engine version. Static: no theme is generated.
toJson() → Map<String, Object?>
Canonical JSON: fixed key order, absent fields left out.
toString() → String
A string representation of this object.
override
withName(String? name) → ThemeIntent
This intent with name replaced (null clears it).

Operators

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

Static Properties

none → ThemeIntent
The empty intent (no steering).
final
vocabulary → List<IntentField>
The fields and values a host (or its model) may use, as data. Values are only ever added, never renamed.
final

Static Methods

jsonSchema({bool steerableOnly = true}) → Map<String, Object?>
A JSON Schema (draft 2020-12) for model output, generated from vocabulary. With steerableOnly, families offers only steerableFamilies.
parse(String raw) → IntentParseResult
Parses model output: the first JSON object in raw (surrounding prose and code fences are ignored), then parseJson. Never throws.
parseJson(Object? json) → IntentParseResult
Reads a decoded JSON value leniently: keys and words are matched case-insensitively (ignoring spaces, - and _), a few synonyms are accepted, single values stand in for lists, and everything unusable is dropped and listed. Never throws.
promptFragment({bool steerableOnly = true}) → String
Compact prompt text describing the output format, generated from vocabulary (for models without schema-constrained output). With steerableOnly, families offers only steerableFamilies.

Constants

maxColors → const int
Most colours one intent can name.
maxNameLength → const int
Most characters in name.
maxNameWords → const int
Most words in name.