onRestart property

Future<void> Function()? onRestart
final

Optional async callback invoked before the widget tree rebuilds.

The environment switch has already completed when this fires, so Env.get(...) returns values from the new environment. Use this to re-initialise services (Sentry, Dio clients, etc.) that were originally set up in main().

The rebuild is deferred until this future completes.

Implementation

final Future<void> Function()? onRestart;