Recently I am migrating to null safety. Updated the firebase_analytics: ^8.0.2.
Now facing problem with this.observer.subscribe(this, ModalRoute.of(context)); Can some one help what to pass second argument.
class _BookedClassDetailsPageState extends
State<BookedClassDetailsPage> with SingleTickerProviderStateMixin, RouteAware{
late FirebaseAnalyticsObserver observer;
@override
void initState() {
super.initState();
observer=widget.repository.analyticsService.getAnalyticsObserver();
observer.analytics.setCurrentScreen(
screenName: 'Booked Class Page',
screenClassOverride: 'BookedClassPage'
);
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
observer.subscribe(this, ModalRoute.of(context));
}
@override
void dispose() {
observer.unsubscribe(this);
super.dispose();
}
}
you can change the type ModalRoute to PageRoute via key word "as", like this:
observer.subscribe(this, ModalRoute.of(context) as PageRoute);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With