Skip to content
Setup Firebase with a Flutter app
Add Firebase to your Flutter app
- Create a Firebase project
- Register your app with Firebase
- Create a Firebase android app inside the Firebase project
- Add apps’s package name
- Add app nickname
- Add SHA-1 fingerprint ( cd android && ./gradlew signingReport )
- Add a Firebase configuration file
- Download the google_services.json file
- Copy it to the directory /android/app
- Configure the gradle files
- @project_level_gradle : Add Google’s Maven repository ( in buildscript and in allprojects sections )
- @project_level_gradle : Add google services plugin ( classpath ‘com.google.gms:google-services:4.3.4’ )
- @app_level_gradle: Add apply plugin: ‘com.google.gms.google-services’ at the top
- @app_level_gradle: Add dependency (optional)
implementation platform(‘com.google.firebase:firebase-bom:25.12.0’) implementation ‘com.google.firebase:firebase-analytics-ktx’ - @app_level_gradle: Enable multidex
Add FlutterFire plugins
- Open your pubspec.yaml file.
- Add the plugin for Firebase Core Flutter SDK: firebase_core: ^0.5.0+1
- Add plugin for Firebase Authentication: firebase_auth: ^0.18.1+2
- Add plugin for Firebase cloud firestore: cloud_firestore: ^0.14.3
- Get the dependencies. Run command: flutter pub get