Recipes
Shut down a controlled host
Stop new input, detach runtime hooks, drain accepted incidents, and end the manager lifecycle safely.
v0.1.0-dev.1Intermediateark_error_manager
Shut down a controlled host
Command-line processes, workers, desktop shells, embedded hosts, and tests can have a real teardown lifecycle.
Use this order:
- stop accepting feature input;
- detach isolate and Flutter bindings;
- call
flushto await accepted incidents; - close separately owned Reporter resources if required;
- call
closeon the manager.
dart
flutterBinding?.detach();
isolateBinding?.detach();
await manager.flush();
await manager.close();
Detach first so a global callback cannot submit work while the manager is closing. flush is synchronization and does not change lifecycle state; close is terminal.
After close, captureError returns false, while handleError completes with StateError.