updateNode static method
EditorEdit
updateNode(
- ElementId id,
- Node update(
- Node node
)
)
Implementation
static EditorEdit updateNode(
rt.ElementId id,
rt.Node Function(rt.Node node) update,
) {
return (scene) {
final node = rt.findById(scene, id);
if (node == null) {
return EditorEditResult(scene: scene);
}
final nextNode = update(node);
if (identical(nextNode, node) || nextNode == node) {
return EditorEditResult(scene: scene, primaryId: id);
}
return EditorEditResult(
scene: rt.replaceById(scene, id, nextNode),
primaryId: id,
);
};
}