getOptionalComponent method
Implementation
Widget? getOptionalComponent(ID id) {
if (isInEditor) {
final componentNodes = inEditorPages[id]?.nodes;
if (componentNodes == null) return null;
final rootNode = const NodeRendering().renderTree(componentNodes);
return rootNode.toWidget(
context: this,
state: WidgetState(node: rootNode, loop: 0),
);
} else {
assert(forPlayPages.containsKey(id), 'Component with id $id not found');
if (!forPlayPages.containsKey(id)) return null;
return forPlayPages[id]!.call();
}
}