How to setup Firebase with Flutter(Android + SHA1) project for complete beginners 2021
As you may have know the increasing popularity of flutter framework in cross Platform community the easy it give us in building beautiful UI when combine with other powerful beast like firebase can be taken to the moon 🚀.
But as said by our uncle ben
just Kidding. Let get started.
Quick Intro on firebase
firebase is a Backend-as-a-Service (Baas) build by google which basically handle major complex backend and give us a variety of tools like ML, Realtime data store, cloud messaging much more which help you the scale fast.
Now let focus on main thing .
Firebase setup with android
go to firebase console click on add New Project Enter the Project name then click on continue toggle the google analytics according to your choose (generally keep it on ) click continue . now it should start building project and few minute your project will be ready
Now it will redirect to project dashboard . Here you can see different platform support by firebase like IOS , android , Web and Unity . WE are going the click on android platform
Now we will be redirected to Android setup overview . with 4 step
step1 : It required Package name and SHA-1 which is optional if you don’t want to use google service like googel pay , google sigin etc.
package name can be found in <app dir>/andorid/app/src/main/AndroidManifest.xml
For SHA-1certification there are different ans we will see the one with android studio
First go to <app-dir>/android/app/build.gradle file then click on Open for Editing in Android Studio
then open new window we will see the Gradle (1) side panel . After that Click on signingReport(2) it will start running process and in a few minute we will SHA-1(3) key in the Run panel
Once filled the details click on Register App
step 2 : download the google-services.json file on paste it in <app dir>/android/app and then click Next
step 3 : Follow then instruction on add the code snippet in the respective file . for this step use android studio to sync the change (if you know how to sync file in other IDE than please comment it.)
it very important to sync the changes in the build.gradle file in <app dir>/android/app directory. In Android studio sync-now button will pop in the top-right corner or it will show open for Editing in Android Studio click on it and then it will automatically sync the dependency.
Step 4 : We are all set with our android setup . Click on Continue to console
and with this we are done with the all for our android application with firebase.
Enjoy the power of firebase.
Thanks for following till the end Hope you found this tutorial useful :)