I had the same question as well. Is seems obvious, that you should add the dependency on com.google.firebase:firebase-analytics to your project.
But… You actually don't need it.
It's easy to test! Just set up the Firebase Analytics like it is described in the docs:
google-services.json
apply plugin: 'com.google.gms.google-services' (and related things)
- Configure multidex
firebase_analytics: ^X.Y.Z in pubspec.yaml
Don't add any Firebase dependencies to you app/build.gradle!
Now, enable the DebugView in Firebase Analytics: adb shell setprop debug.firebase.analytics.app your.package.
Run the app and send some events. Open the DebugView in Firebase Analytics console and you'll see them all!
Probably, all the magic happens in the Google Services Gradle Plugin:
The google-services plugin has two main functions:
Add dependencies for basic libraries required for the services you have enabled. …
You can see the result of this step by running ./gradlew :app:dependencies.
So, the plugin seems to add them for you!
You could also check what dependencies will be autoconfigured, by running ./gradlew :projects from your android dir. Mine is:
Root project 'android'
+--- Project ':app'
+--- Project ':firebase_analytics'
\--- Project ':firebase_core'
Now, after I add firebase_auth to my pubspec.yml and run flutter pub get, this command indeed lists one extra project:
Root project 'android'
+--- Project ':app'
+--- Project ':firebase_analytics'
+--- Project ':firebase_auth'
\--- Project ':firebase_core'
