NodeTransformerManager<O, BC, BS extends BuildSettings, NT extends NodeTypeTransformer<BaseNode, dynamic, dynamic, BuildSettings> > class
abstract
The base class for all node transformers. It holds a registry that maps node types to their relevant transformers.
There are two types of transformers: active and passive.
Passive transformers are transformers that transform their passed nodes into direct widgets and do nothing else.
Conversely, active transformers are transformers that transform their passed nodes into widgets that handle events, different rendering states, and several other mechanics that are not handled by passive transformers and make interfacing with them in the Codelessly editor a much more user-friendly and dynamic experience.
To register your own transformers, use either globalPassiveManager
or globalActiveManager
depending on the type of transformer you want to
register. Then call registerTransformer or registerAllTransformers to
register your transformers in each.
This class is extended by ActiveNodeTransformerManager
and
PassiveNodeTransformerManager. Please refer to each for an in-depth
explanation of how they work.
O
is the output type, probably a Widget.
BC
is the context type, probably a BuildContext.
BS
is the build settings type, probably a WidgetBuildSettings.
NT
is the node transformer type, probably a NodeWidgetTransformer.
Codegen uses different O, BC, BS, and NT types for its transformers.
- Implementers
Constructors
- NodeTransformerManager(GetNode getNode)
Properties
- getNode → GetNode
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
buildWidgetByID(
String id, BC context, {required BS settings}) → O -
Will convert a
T
(probablyBaseNode
) to aK
(probably Widget). Managers can do whatever they want here. This is where they normally wrap the widget with interaction for example. -
buildWidgetFromNode(
BaseNode node, BC context, {required BS settings}) → O -
Will convert a
BaseNode
to anO
(probably Widget). -
getTransformer<
L> () → L -
A convenience method that pulls the relevant transformer by its
type
. -
getTransformerByID(
String id) → NT - Get a transformer from a given node type key.
-
getTransformerByNode(
BaseNode node) → NT -
Get a transformer from a given
node
's type. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerAllTransformers(
Map< String, NT> transformers) → void - Registers a map of transformers in the registry.
-
registerTransformer(
String key, NT transformer) → void -
Registers a transformer in the registry.
The key must match the node
BaseNode.type
. NT is an instance of the NodeTypeTransformer to register. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited