GrovsNavigatorObserver class

A NavigatorObserver that automatically tracks Flutter screen views.

Add it to your MaterialApp.navigatorObservers:

MaterialApp(
  navigatorObservers: [Grovs.navigatorObserver],
  // ...
);

Screen names resolve in this order:

  1. screenNameExtractor if provided.
  2. The route's RouteSettings.name (named routes).
  3. A fallback derived from the route's runtime type.

The resolved name is then translated through the aliases set via Grovs().setScreenAliases(...).

Note: the route-type fallback (step 3) produces obfuscated names in release builds. Name your routes or supply a screenNameExtractor for stable names.

Inheritance

Constructors

GrovsNavigatorObserver({String? screenNameExtractor(Route route)?, Grovs? grovs})

Properties

hashCode → int
The hash code for this object.
no setterinherited
The navigator that the observer is observing, if any.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

didChangeTop(Route topRoute, Route? previousTopRoute) → void
The top most route has changed.
inherited
didPop(Route route, Route? previousRoute) → void
The Navigator popped route.
override
didPush(Route route, Route? previousRoute) → void
The Navigator pushed route.
override
didRemove(Route route, Route? previousRoute) → void
The Navigator removed route.
inherited
didReplace({Route? newRoute, Route? oldRoute}) → void
The Navigator replaced oldRoute with newRoute.
override
didStartUserGesture(Route route, Route? previousRoute) → void
The Navigator's routes are being moved by a user gesture.
inherited
didStopUserGesture() → void
User gesture is no longer controlling the Navigator.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited