A2uiCatalog class
A parsed catalog: an id plus the components and client functions it exposes.
Mirrors the spec's catalog.json: components and functions are keyed by
name. Their order is kept for round trips, but is not what the model sees
(a2ui_agent lists signatures alphabetically); the order of a component's
properties is, since Express arguments are positional.
A catalog is immutable, schemas included: A2uiCatalog.fromJson and
A2uiCatalogComponent.simple keep frozen copies. A schema passed to the
raw A2uiCatalogComponent(...) constructor must not be changed later,
since the form a2ui_agent reads is derived once per catalog.
Constructors
-
A2uiCatalog({required String id, required Iterable<
A2uiCatalogComponent> components, Iterable<A2uiCatalogFunction> functions = const [], String? instructions}) - Creates an A2uiCatalog from its components and functions, keyed by name. Names must be unique.
-
A2uiCatalog.fromJson(Map<
String, dynamic> json) -
Builds an A2uiCatalog from a spec
catalog.jsondocument.factory
Properties
-
components
→ Map<
String, A2uiCatalogComponent> -
The components available in this catalog, keyed by component name.
final
-
defs
→ Map<
String, dynamic> -
Any document-level
$defs, kept so local#/$defs/...references in a published catalog still resolve after a round trip.final -
functions
→ Map<
String, A2uiCatalogFunction> -
The client functions available for
?checkrules and client-side calls, keyed by function name. Empty for catalogs that declare none.final - hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
Globally-unique catalog id (also used as
catalogIdoncreateSurface).final - instructions → String?
-
Catalog-wide guidance for the model (the spec's
instructions), included in the prompt after the component signatures.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
extend(
{required String id, Iterable< A2uiCatalogComponent> components = const [], Iterable<A2uiCatalogFunction> functions = const [], String? instructions}) → A2uiCatalog -
Returns a copy under a new
idwithcomponentsandfunctionsadded, for extending a base catalog with bespoke components. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
Serializes this catalog to its
catalog.jsonshape. -
toString(
) → String -
A string representation of this object.
inherited
-
withId(
String id) → A2uiCatalog -
Returns a copy registered under a different
id.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited