Screen Views

Record Flutter screen views manually or with AnsightNavigatorObserver.

Record a view directly:

await Ansight.instance.screenViewed(
  'Order details',
  details: <String, String>{'orderId': '123'},
);

For Navigator 1.x flows, attach the observer:

MaterialApp(
  navigatorObservers: <NavigatorObserver>[AnsightNavigatorObserver()],
);

The observer records pushed, replaced, and popped routes and maintains the stack returned by flutter.get_navigation_state. For Router-based navigation, call screenViewed(...) from the app’s route-state integration.