StacObserver class
A Stac widget that rebuilds its child whenever a state value it reads changes.
Placeholders inside the child are filled from the registry each time it
is built, so a value set with setValue shows up without rebuilding the
screen. The keys to watch are taken from the placeholders in the child and
the conditions of conditionals inside it, or listed in keys.
StacObserver(
child: StacText(data: '{{cartCount}} items'),
)
{
"type": "observer",
"child": {"type": "text", "data": "{{cartCount}} items"}
}
- Inheritance
-
- Object
- StacElement
- StacWidget
- StacObserver
- Annotations
-
- @JsonSerializable.new()
Constructors
-
StacObserver({List<
String> ? keys, StacWidget? child}) -
Creates a StacObserver that rebuilds
childwhen a watched key changes.const -
StacObserver.fromJson(Map<
String, dynamic> json) -
Creates a StacObserver from a JSON map.
factory
Properties
- child → StacWidget?
-
The widget to rebuild, with its placeholders filled.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
jsonData
→ Map<
String, dynamic> ? -
Raw JSON data for this widget
finalinherited
-
keys
→ List<
String> ? -
The state keys to watch. When null, the keys are the first segments of
the placeholders found in child, such as
userfor{{user.name}}, and the names that the conditions of conditionals in child read, such asitemsinlength(items) > 0.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- type → String
-
Widget type identifier.
no setteroverride
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
Converts this StacObserver instance to a JSON map.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited