Flutter: Firebase DebugView Ненадежное ведение журнала событий аналитики - PullRequest
0 голосов
/ 23 апреля 2020

Я включил debugview и аналитику для моего приложения. Я также создал logEvent для захвата нажатий GestureDetector. К сожалению, кажется, что отладочный обзор для firebase очень ненадежен, и только некоторые события касаются. Debugview просто ненадежен? Или есть способ захвата частых событий, таких как нажатия кнопок / нажатия GestureDector?

Захват событий:

 Container buildShopCards(DocumentSnapshot doc) {
    return Container(
      width: MediaQuery.of(context).size.width - 50,
      child: Padding(
        padding: const EdgeInsets.all(3.0),
        child: GestureDetector(
          onTap: () {
            //doc = all store details
            logAnalytics.buttonPushed(
              docId: doc.documentID,
              buttonName: doc.data['name'],
              currentPageName: StorePickerRoute,
            );
            Navigator.pushNamed(context, StoreDetailsRoute, arguments: doc);
          },
          child: Card(
            shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.circular(10.0),
            ),
            color: widgetDecoration.offWhiteColour,
            child: Padding(
              padding: const EdgeInsets.all(8.0),
              child: Center(
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: <Widget>[
                    AutoSizeText(
                      '${doc.data['name']}',
                      style: TextStyle(fontSize: 23.0),
                      minFontSize: 15,
                      maxLines: 1,
                    ),
                  ],
                ),
              ),
            ),
          ),
        ),
      ),
    );
  }

Функция logEvent:

void buttonPushed({String docId, String buttonName, String currentPageName}) {
    //remove '/' from route name
    currentPageName = currentPageName.substring(1);

    analytics.logEvent(
      name: 'button_pushed',
      parameters: {
        //can't have '/' from route names in the values. Need to remove
        'store_doc_id' : docId != null ? docId : "null",
        'button_name' : buttonName != null ? buttonName : "null",
        'origin_page' : currentPageName != null ? currentPageName : "null",
      },
    );
  }
...