FirebaseAnalyticsObserver constructor
FirebaseAnalyticsObserver({
- required FirebaseAnalytics analytics,
- ScreenNameExtractor nameExtractor = defaultNameExtractor,
- dynamic onError(
- 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,
Function(PlatformException error)? onError,
}) : _onError = onError;