App Lifecycle

Capture Flutter foreground and background state automatically or through explicit lifecycle calls.

AnsightFlutterInstrumentation.install() registers a WidgetsBindingObserver and maps Flutter lifecycle changes to the native Ansight runtime.

For an app-owned integration:

await Ansight.instance.setAppLifecycleState(
  AnsightLifecycleState.foreground,
);

Call AnsightFlutterInstrumentation.instance.uninstall() to remove observers and restore error handlers where possible. Runtime deactivation and Flutter instrumentation removal are separate operations.