KletsoNode class final
One component in a surface: a type, a bag of props and its actions.
Props are kept as decoded JSON. The typed getters never throw and return the supplied default when the prop is absent, has the wrong type or is an unresolved binding. Use KletsoSurface.resolveNode to substitute bindings with values from the surface data first.
- Annotations
-
- @immutable
Constructors
-
KletsoNode({required String id, required String type, JsonMap props = const <String, Object?>{}, List<
KletsoAction> actions = const <KletsoAction>[]}) - Creates a node.
- KletsoNode.fromJson(String id, Object? json, {String path = r'$'})
-
Parses a node with the given
idfrom its wire form.factory
Properties
-
actions
→ List<
KletsoAction> -
Actions in declaration order, unmodifiable.
final
-
allChildIds
→ List<
String> -
Every child id this node references:
props.childrenplus thechildrenlist of each entry inprops.items(tabs, accordion). Validators and renderers walk the tree with this.no setter - hashCode → int
-
The hash code for this object.
no setteroverride
- id → String
-
The component id (key in the surface's
componentsmap).final - props → JsonMap
-
Decoded props, unmodifiable.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- type → String
-
Component type; built-in name or namespaced custom type.
final
Methods
-
action(
String actionId) → KletsoAction? -
The action with
actionIdornull. -
binding(
String key) → KletsoBinding? -
The binding at
key, ornullwhen the prop is a literal or absent. -
boolean(
String key, {bool fallback = false}) → bool -
Boolean prop or
fallback. -
childIds(
[String key = 'children']) → List< String> -
The child ids listed under
key(childrenby default). -
has(
String key) → bool -
Returns
truewhenkeyis present. -
list(
String key) → List< Object?> - List prop or an empty list.
-
map(
String key) → JsonMap - Object prop or an empty map.
-
mapList(
String key) → List< JsonMap> -
List prop filtered to objects, for
items,fields,series,rows. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
number(
String key, {num fallback = 0}) → num -
Numeric prop or
fallback. -
numberOrNull(
String key) → num? - Nullable numeric prop.
-
prop(
String key) → Object? -
The raw value of
keyornull. -
string(
String key, {String fallback = ''}) → String -
String prop or
fallback. -
stringOrNull(
String key) → String? - Nullable string prop.
-
toJson(
) → JsonMap - Wire form (without the id, which is the map key).
-
toString(
) → String -
A string representation of this object.
override
-
withProps(
JsonMap props) → KletsoNode -
Returns a copy with
propsreplaced.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override