* Phase 4b: Flutter setState → build (the Dart analog of react-render). In a * StatefulWidget's State class, `setState(() {…})` re-runs `build(context)`, but * that hop is framework-internal (Flutter calls build), so a flow like * "onPressed → _increment → setState → rebuilt UI" dead-ends at setS
(queries: QueryBuilder, ctx: ResolutionContext, onYield: MaybeYield)
| 483 | * Flutter State classes. Over-approximation accepted (reachability-correct). |
| 484 | */ |
| 485 | async function flutterBuildEdges(queries: QueryBuilder, ctx: ResolutionContext, onYield: MaybeYield): Promise<Edge[]> { |
| 486 | let scanned255 = 0; |
| 487 | const edges: Edge[] = []; |
| 488 | const seen = new Set<string>(); |
| 489 | for (const cls of queries.iterateNodesByKind('class')) { |
| 490 | if ((++scanned255 & 63) === 0) await onYield(); |
| 491 | const children = queries.getOutgoingEdges(cls.id, ['contains']) |
| 492 | .map((e) => queries.getNodeById(e.target)) |
| 493 | .filter((n): n is Node => !!n && n.kind === 'method'); |
| 494 | const build = children.find((n) => n.name === 'build'); |
| 495 | if (!build || !build.filePath.endsWith('.dart')) continue; |
| 496 | let added = 0; |
| 497 | for (const m of children) { |
| 498 | if (added >= MAX_CALLBACKS_PER_CHANNEL) break; |
| 499 | if (m.id === build.id) continue; |
| 500 | const content = ctx.readFile(m.filePath); |
| 501 | const src = content && sliceLines(content, m.startLine, m.endLine); |
| 502 | if (!src || !FLUTTER_SETSTATE_RE.test(src)) continue; |
| 503 | const key = `${m.id}>${build.id}`; |
| 504 | if (seen.has(key)) continue; |
| 505 | seen.add(key); |
| 506 | edges.push({ |
| 507 | source: m.id, target: build.id, kind: 'calls', line: m.startLine, |
| 508 | provenance: 'heuristic', |
| 509 | metadata: { synthesizedBy: 'flutter-build', via: 'setState', registeredAt: `${build.filePath}:${build.startLine}` }, |
| 510 | }); |
| 511 | added++; |
| 512 | } |
| 513 | } |
| 514 | return edges; |
| 515 | } |
| 516 | |
| 517 | /** |
| 518 | * Reactive ArkUI property decorators: assigning a property carrying one of |
no test coverage detected