【Dart/Flutter】How to send logEvent() to Firebase Analytics ?
This implementation makes it easy to send logEvent() to Firebase Analytics.
My application development environment
- Flutter 1.9.1+hotfix.4
- Dart 2.5.0
Preparations for sending logEvent() to Firebase Analytics with Flutter
First, add a Firebase Analytics plugin to your application.
This plugin’s URL:https://pub.dev/packages/firebase_analytics
Note:Otherwise, when relating to Firebase plugins is not the latest version, Execution environment Bug often occurs.
How to send logEvent() to Firebase Analytics
I will explain about Firebase Analytics plugin that presuppose if you tap on an article to go to the details page.
Event name defined in Enum
The event name send to Firebase Analytics define as Enum.
If you don’t use Enum an unexpected event name passed in the arguement.
I think it will be helpful to understand Enum below the article.
Reference:https://qiita.com/arthur_foreign/items/b40820c5f3a0f06ffe08
※ sorry… only Japanese…
Implementation of send logEvent() to Firebase Analytics.
Next, to make a process common to send logEvent() to Firebase Analytics.
Because, I don’t want to same process to write every time that must be send event name and parameters to Firebase Analytics.
analyticsLogEvent(AnalyticsEventType eventType, ...)As I explained about Enum earlier, except for AnalyticsEventType type cannot be passed an argument.
Also, Anything can track, parameter’s type is <String, dynamic>.
Execute a function from widget to send logEvent() to Firebase Analytics.
This implementation makes easy to send logEvent() to Firebase Analytics.
