mutate method

void mutate(
  1. void fn(
    1. Scene scene
    ), {
  2. bool structural = false,
})

Runs fn to mutate scene and schedules the appropriate updates.

Prefer this helper over touching scene.layers directly:

  • When structural is true (add/remove/reorder nodes/layers), this calls notifySceneChanged to restore minimal invariants (e.g. selection).
  • When structural is false (geometry-only changes), this schedules a repaint once per frame.

Implementation

void mutate(void Function(Scene scene) fn, {bool structural = false}) {
  _sceneCommands.mutate(fn, structural: structural);
}