StacLifecycle class
A Stac widget that runs actions when it appears and when it goes away.
onLoad runs once, after the first frame that shows child. It is the
place to load data into state when a screen opens. onDispose runs after
the widget has left the tree, which suits state updates such as
setValue.
StacLifecycle(
onLoad: StacNetworkRequest(url: 'https://api.example.com/posts', ...),
child: StacText(data: 'Posts'),
)
{
"type": "lifecycle",
"onLoad": {"actionType": "networkRequest", "url": "..."},
"child": {"type": "text", "data": "Posts"}
}
- Inheritance
-
- Object
- StacElement
- StacWidget
- StacLifecycle
- Annotations
-
- @JsonSerializable.new()
Constructors
- StacLifecycle({StacAction? onLoad, StacAction? onDispose, StacWidget? child})
-
Creates a StacLifecycle around
child.const -
StacLifecycle.fromJson(Map<
String, dynamic> json) -
Creates a StacLifecycle from a JSON map.
factory
Properties
- child → StacWidget?
-
The widget to show.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
jsonData
→ Map<
String, dynamic> ? -
Raw JSON data for this widget
finalinherited
- onDispose → StacAction?
-
The action run after the widget has left the tree.
final
- onLoad → StacAction?
-
The action run once, after the first frame that shows child.
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 StacLifecycle instance to a JSON map.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited