NodeBinder class

Applies bindings, conditions and text interpolation to the nodes of a node tree (from its NodeSource), reading from scope (a screen's variables, with the app's values around them) and, inside data-bound lists, from each item's ItemScope.

preview is a design canvas: a text's ${...} shows the value the scope (the variables' defaults, if the editor gives one) has, else a placeholder (${user.name} shows "Name"); nothing ticks.

It is the runtime's TreeBindings: what a RenderTree takes its nodes as shown from, and its render objects their values.

Implemented types

Constructors

NodeBinder({ValueScope? scope, ValueScope? scopeOf(String id)?, LayoutLogic logic = LayoutLogic.none, Expressions engine = const Expressions(), bool preview = false, ValueScope? projectScope, VoidCallback? persistComponentVariable(VariableScope variables, Variable variable, String key)?})

Properties

componentScopeCount → int
How many component instances have their scopes kept.
no setter
engine → Expressions
final
hashCode → int
The hash code for this object.
no setterinherited
hasValues → bool
Whether names can be read at all (there are values to read them from).
no setteroverride
logic ← LayoutLogic
Replaces the conditions (an edit); the tree re-applies its boxes.
no getter
persistComponentVariable → VoidCallback? Function(VariableScope variables, Variable variable, String key)?
Keeps a component variable declared persist: true in the app's storage, per instance: called with the instance's variable scope, the variable and the storage key of that instance's value (componentVariableKey); returns what stops keeping it. Null: such a variable starts from its value in every instance, every time.
final
preview → bool
final
projectScope → ValueScope?
The project's variables (and the app scopes around them), which a component definition reads besides its parameters and its own variables; null: the outermost variable scope around scope, when there are several (a page's and the app's), else none. A definition never reads the page's (or canvas's) variables.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scope → ValueScope?
Where names are read; null: no bindings apply (a canvas without defaults still shows placeholders in preview).
final
scopeOf → ValueScope? Function(String id)?
Where node id reads names, when that depends on the node: a design board holds every screen, each with its own variables, so a node reads its canvas's scope. Null (or a null result): scope.
final

Methods

bind(NodeSource source, Node node, Object? instance) → BoundNode
node (in repeat instance) as shown.
override
componentScope(InstanceSource source) → ValueScope?
The scope the nodes of component instance source read from: its own variables (one set per instance), over its parameters (props, bound in the caller's scope), over the project's variables and the runtime's scopes (screen, route, theme...). Never the caller's variables.
dispose() → void
Lets go of the item, local and node scopes.
forgetItem(ProvidedItem instance) → void
Lets go of the scope of repeat instance (its widget no longer shows it). Not disposed: a box leaving with it may still listen.
itemsOf(NodeSource source, Node list, Object? instance) → List<Object?>?
The items node list (in instance) is bound to: its data binding or a condition setting it, as a list; null when it has none.
localScopeOf(NodeSource source, String id, Object? instance) → LocalScope?
The LocalScope node id (in instance) gives itself and the nodes inside it, or null when it gives none (localNames) or nothing binds.
nodeScope(NodeSource source, String id, {Object? instance}) → NodeValuesScope?
The names node id (in instance) gives the nodes inside it, which its render objects write; null when it declares none, or there's no scope.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onItemsChanged(String owner, Object? instance, void refresh(List<Object?> items)?) → void
Registers (or with null, drops) refresh for node owner in instance.
providedScope(ProvidedItem instance) → ItemScope?
The scope provideItem gave repeat instance; null: none (yet).
provideItem(NodeSource source, ProvidedItem instance, {required int index, Object? item}) → ItemScope?
Gives repeat instance (of a widget whose items it gives itself) its item at index: the scope its nodes read item and index from, made or moved to them (the boxes that read them re-apply).
publish(NodeSource source, String id, Object? instance, String name, Object? value) → void
Sets name (track, flip, tilt, transform, sticky, view) of the names node id (in instance) gives the nodes inside it, to what its render objects show now. Nothing when the node gives none.
override
releaseInstance(Object instance) → void
Lets go of the scopes of instance and of every instance, list item and node scope inside it: it left the tree. Showing it again starts it afresh, as a Flutter State does when its element is unmounted (a persisted variable starts from its stored value).
override
rootScopeOf(String id) → ValueScope?
The scope node id reads names from, outside its lists and node scopes: scopeOf's, else scope.
scopeFor(NodeSource source, String id, Object? instance) → ValueScope?
The scope node id (in instance) reads from: scope, the item scope of the data-bound list it repeats in, or the LocalScope of the nearest node around it (or itself) that gives one (localNames).
toString() → String
A string representation of this object.
inherited
valuesFor(NodeSource source, String id, Object? instance) → BoundValues?
The values node id (in instance) reads and writes: the variables around it, its list item; null when there are none.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

localNames → Map<String, bool Function(Node n)>
The names a node gives itself and the nodes inside it, by what gives them: a node that follows the pointer shares its drag as dismiss (api.DismissibleBehavior) or pan (api.Pan), and as the legacy drag for both. Each such node reads from a LocalScope of its own (localScopeOf), which the behavior sets.
final

Static Methods

componentVariableKey(ComponentInstance instance, Variable variable) → String
The storage key of persisted variable variable of component instance instance: codelessly.component.<Type>.<instance path>.<name>.