applyArgs method
Instantiate: set every parameter-bound property whose parameter is
named in args. This is what the export matrix does per language and
what a caller's arguments do at mount — the model-level half of
BannerScene(title: …).
Implementation
void applyArgs(Map<String, Object?> args) {
edit(() {
for (var p in params) {
if (p.kind != SceneParamKind.list) continue;
if (args[p.name] case List raw) {
_lists[p.name] = [
for (var item in raw) (item as Map).cast<String, Object>(),
];
}
}
for (var (node, _) in walk()) {
for (var entry in node.bindings.entries) {
// An item binding takes its value from the repeat, below.
if (entry.value case ParamRef(:var name)
when args.containsKey(name)) {
setSceneProperty(node, entry.key, args[name]);
}
}
}
// A repeat over data that just changed is a new rule: rebuilt from
// the recorded binding, template row included.
bindRepeats(this);
});
}