Flutter

Root hooks and ownership

Attach Flutter framework and platform callbacks without replacing another owner silently or producing duplicate incidents.

v0.1.0-dev.1Advancedark_error_manager_flutter

Root hooks and ownership

FlutterError.onError receives framework-caught failures from build, layout, paint, callbacks, and explicit FlutterError.reportError calls. PlatformDispatcher.onError receives unhandled root-isolate errors outside those framework callbacks when no nearer Zone consumes them.

FlutterErrorManagerBinding attaches both paths:

dart
final FlutterErrorManagerBinding binding =
    FlutterErrorManagerBinding(manager: manager)..attach();

Ownership is explicit:

  • repeated attach on the same binding is idempotent;
  • a second active binding throws StateError;
  • detach restores callbacks captured during attach;
  • a callback installed later by another owner is not overwritten;
  • child-isolate errors require IsolateErrorManagerBinding.

FlutterPreviousErrorHandlerPolicy.preserve invokes the previous callback after manager submission. This retains Flutter's normal debug output. Use replace only after deliberately moving the previous behavior elsewhere.

Do not preserve a second remote crash reporter without a deduplication plan.

ARKTELOS

Purpose-built engineering systems for software that has to hold.