CodelesslyContext class
Holds data passed from the Codelessly instance down the widget tree where
all of the WidgetNodeTransformer
s have access to it.
- Mixed in types
Constructors
-
CodelesslyContext({required Map<
String, dynamic> data, required Map<String, CodelesslyFunction> functions, required Map<String, WidgetBuilder> ? externalComponentBuilders, required Map<String, Observable< nodeValues, required Map<List< >ValueModel< >Object?> >String, Observable< variables, required Map<VariableData> >String, BaseCondition> conditions, required String? layoutID}) -
Creates a CodelesslyContext with the given
data
, functions, and nodeValues. - CodelesslyContext.empty({String? layoutID})
- Creates a CodelesslyContext with empty an empty map of each property.
Properties
-
conditions
→ Map<
String, BaseCondition> -
A map that holds the current state of all conditions.
The key is the condition's id.
final
-
data
↔ Map<
String, dynamic> -
A map of data that is passed to loaded layouts for nodes to replace their
values with.
getter/setter pair
-
externalComponentBuilders
↔ Map<
String, WidgetBuilder> -
getter/setter pair
-
functions
↔ Map<
String, CodelesslyFunction> -
A map of functions that is passed to loaded layouts for nodes to call when
they are triggered.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- layoutID ↔ String?
-
The passed ID of the layout to load.
getter/setter pair
-
nodeValues
→ Map<
String, Observable< List< >ValueModel< >Object?> > -
A map that holds the current values of nodes that have internal values.
final
-
props
→ List<
Object?> -
The list of properties that will be used to determine whether
two instances are equal.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
setFunctions
← Map<
String, CodelesslyFunction> -
no getter
- stringify → bool?
-
If set to
true
, the toString method will be overridden to output this instance's props.no setterinherited -
variables
→ Map<
String, Observable< VariableData> > -
A map that holds the current state of all variables.
The key is the variable's id.
final
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
addToNodeValues(
BaseNode node, List< ValueModel< values) → voidObject?> > -
Add
values
to the nodeValues map corresponding to thenode
.values
refer to the local values of the node's properties that can be changed, for example, with set value action. -
copyWith(
{Map< String, dynamic> ? data, Map<String, CodelesslyFunction> ? functions, Map<String, WidgetBuilder> ? dynamicWidgetBuilders, Map<String, Observable< ? nodeValues, Map<List< >ValueModel< >Object?> >String, Observable< ? variables, Map<VariableData> >String, BaseCondition> ? conditions, String? layoutID, bool forceLayoutID = false}) → CodelesslyContext -
Creates a copy of this CodelesslyContext with the given
data
,functions
, andnodeValues
. -
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
inherited
-
findVariableByName(
String? name) → Observable< VariableData> ? -
Returns a reverse-lookup of the
VariableData
associated with a givenname
. -
getVariableValue<
R extends Object> (String name) → R? -
Allows to easily get the
newValue
of a variable with a givenname
. Returns null if the variable does not exist. IfR
is provided, the returned value will be cast to that type. -
handleActionConnections(
ActionModel actionModel, Map< String, BaseNode> nodes) → Future<void> - Used for actions that are connected to one or more nodes. Ex. submit action is connected to a text field node to access its data to submit to the server.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
updateVariable(
String name, Object? value) → bool -
Allows to easily
value
of a variable with a givenname
. Returns false if the variable does not exist. Returns true if the variable was updated successfully. -
variableNamesMap(
) → Map< String, VariableData> -
Returns a map of all of the
VariableData
s in variables mapped by their name.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited