collectSnapshots function

List<Snapshot> collectSnapshots(
  1. List<Scene> scenes
)

Gathers every Snapshot widget from scenes in deterministic build order — the in-process subtree-capture sibling of collectSnapshotSources, walking the same tree with no mounting and no async.

Unlike the source collectors this returns an ordered List, never a deduped Set: each unkeyed Snapshot resolves its pre-captured raster by a stable build-order index, so two distinct unkeyed instances are two captures, and the order here is the order the Snapshots build (the same order the capture scope's order cursor hands out). The render shell hands this list to captureSnapshotChildren (each Snapshot.child under the ImageResolverScope) before frame 0, then mounts the resulting SnapshotCaptureScope above the composition for the frame loop.

Implementation

List<Snapshot> collectSnapshots(List<Scene> scenes) {
  final snapshots = <Snapshot>[];
  walkSceneTree(scenes, (widget) {
    if (widget is Snapshot) snapshots.add(widget);
  });
  return snapshots;
}