AiWidgetRegistry class
A name→widget allowlist for generative UI: the model emits a DataPart
with a dataType discriminator and a JSON payload, and the registry maps it
to a Flutter widget.
This is a deliberate allowlist — only registered dataTypes render (no
reflection, no arbitrary instantiation), so a model can't conjure UI you
didn't sanction. Unknown types fall back (see AiDataView).
Constructors
-
AiWidgetRegistry([Map<
String, AiDataWidgetBuilder> ? builders]) -
Creates a registry, optionally seeded with
builders.
Properties
Methods
-
build(
BuildContext context, DataPart part) → Widget? -
Builds the widget for
part, ornullif itsdataTypeis not registered. -
contains(
String dataType) → bool -
Whether a builder is registered for
dataType. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
register(
String dataType, AiDataWidgetBuilder builder) → AiWidgetRegistry -
Registers
builderfordataType, replacing any previous entry. Returns the registry for chaining. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited