Open In App

How to Add Firebase to Flutter App?

Improve
Improve
Like Article
Like
Save
Share
Report

Firebase is a product of Google which helps developers to build, manage, and grow their apps easily. It helps developers to build their apps faster and in a more secure way. No programming is required on the firebase side which makes it easy to use its features more efficiently. It provides services to android, ios, web, and unity. It provides cloud storage. It uses NoSQL for the database for the storage of data.

Step by Step Implementation

Step 1: First, you have to visit the Firebase console. Now let’s  move to the next step. Click on the “Add project”  as shown in the below image.

Step 2: Provide the firebase project name. Let’s give it “geeksforgeeks”. Then click on “Continue”. Disable the “Enable Google Analytics for this project” because we don’t need this and click on “Create project”. It takes some time to wait till the project is created, After that click on “Continue”. Now there will be a screen, You to find the Android button and click on it as shown in the below image.

Now time to add firebase to your Android App.

Step 3: We have to give the “Android package name”, where it can be found????. Don’t know, Let’s find this in the next step.

Step 4: Let’s go to your flutter project, and click on the “Android” folder, and in the App-level build gradle file you find Application id just copy it and paste it to “Android package name”.

Step 5: In “App nick-name” you give any name or leave it blank because it is optional. In “Debug signing certificate SHA-1 (optional) ” also leave it blank for the time or you can give the debug SHA keys. Now click on “Register app”. Now you have to “Download Config file”, Switch to the Project view in Android Studio/vs code to see your project root directory. Move the “google-services.json” file you just downloaded into your Android app module root directory.

Now click on “Next”.

Step 6: Add Firebase SDK. The Google services plugin for Gradle loads the google-services.json file you just downloaded. Modify your build.gradle files to use the plugin. Project-level build.gradle (<project>/build.gradle):

Step 7: App-level build.gradle (<project>/<app-module>/build.gradle):

Step 8: After back to the firebase console and click “Next”. And then Click on “Continue to Console”.


Last Updated : 20 Feb, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads