How To Track Screen On Firebase Analytics Flutter

I'm trying to add a firebase analytics track screen to my app. I tried to enter it in the menu like in the picture below but it always doesn't read

menu for tracking screen

I've tried some code but it doesn't work. For now, the code I'm using is as follows:

      FirebaseAnalyticsObserver(analytics: analytics);

 onGenerateRoute: widget.appRouter.onGenerateRoute,
          builder: EasyLoading.init(),
          initialRoute: splashScreenRoute,
          navigatorObservers: <NavigatorObserver>[
            // FirebaseAnalyticsObserver(analytics: _analytics),

and on each screen I add code like this below on each initState()

analytics.setCurrentScreen(screenName: 'Page Detail Mobil');

i have re-run the app but it doesn't work track screen and put in firebase analytic. please help me thank you



I have used different function to track my screens. I have called my logScreens function on routing or you can call it on initState of each pages.

This is my analytic_service.dart

class AnalyticsService {
 final FirebaseAnalytics _analytics = FirebaseAnalytics();

  Future logScreens({@required String? name}) async {
  await _analytics.setCurrentScreen(screenName: name);

and this is locator.dart

import 'package:get_it/get_it.dart';

import 'analytic_service.dart';

GetIt locator = GetIt.instance;

void setupLocator() {
  if (!locator.isRegistered<AnalyticsService>()) {
    locator.registerLazySingleton(() => AnalyticsService());

Call the logScreens function when needed.

locator<AnalyticsService>().logScreens(name: "Dashboard");

And this will be logged in analytics like this.

enter image description here

Try this on DebugView. Click on the screen_view. It will show the screen like this.

enter image description here