restartOnGraphChange property

bool restartOnGraphChange
final

Whether a hot reload that changed what root registers restarts the graph.

A hot reload patches code but does not run build() again, so a registration added, removed or given another lifetime would otherwise wait for a hot restart — and until then the app resolves against the old graph. On each reload this runs root again without building anything (CobaltScope.previewRegistrations) and compares its registrations with the live root's; only when they differ does it call CobaltAppScopeController.restart, and say what changed in the debug console. A reload that touched only widgets or factory bodies keeps the graph, and everything below it, as it was.

Debug builds only, since that is the only place a hot reload happens. Changes to bootstrap are not compared. Not available to CobaltAppScope.start, which has no builder to run.

Implementation

final bool restartOnGraphChange;