Investigate background and resume behavior

Record Flutter lifecycle state so you can place events and telemetry in the context of foreground and background transitions.

When behavior changes after a user leaves or returns to your app, lifecycle evidence helps you locate that transition in the session. Capture state automatically or report it from your app’s own lifecycle integration.

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.