FirebaseAnalyticsObserver constructor

FirebaseAnalyticsObserver({
  1. required FirebaseAnalytics analytics,
  2. ScreenNameExtractor nameExtractor = defaultNameExtractor,
  3. RouteFilter routeFilter = defaultRouteFilter,
  4. dynamic onError(
    1. PlatformException error
    )?,
})

Creates a NavigatorObserver that sends events to FirebaseAnalytics.

When a route is pushed or popped, nameExtractor is used to extract a name from RouteSettings of the now active route and that name is sent to Firebase. Defaults to defaultNameExtractor.

If a PlatformException is thrown while the observer attempts to send the active route to analytics, onError will be called with the exception. If onError is omitted, the exception will be printed using debugPrint().

Implementation

FirebaseAnalyticsObserver({
  required this.analytics,
  this.nameExtractor = defaultNameExtractor,
  this.routeFilter = defaultRouteFilter,
  Function(PlatformException error)? onError,
}) : _onError = onError;