Back in 2020 when I started working with Flutter, I faced a lot of issues using various functionalities of Firebase in my Flutter Apps, so I decided to pen down proper procedure to demonstrate working of each function in a simple and easy to follow method. I will be writing a series of articles on Flutter+Firebase which will cover all the functionalities that Firebase has to offer one by one.In this very first article of the series, we will demonstrate how to connect a Flutter application to Firebase. Before that let us have brief idea of what is Firebase?
Firebase is a no-SQL cloud database by Google. It provides with various features to develop quality apps. It provides cross-platform SDKs to build apps in android, iOS, web, C++ and Unity. Along with back end, storage and authentication services it also provides ML kit with features like Face Detection, Barcode Scanning, Text Recognition and many more.
Lets Go through the steps:
- Go to Firebase console and click on add project
2. Enter your project name and click continue
3. It is optional to check the button for enable Google Analytics. If you are building the project just for learning purpose, I would recommend to disable Analytics.
4. Now click on “Create project” and after it is created, continue to project console. We have now created a project on Firebase. Now its time to link our Firebase project to Flutter app. For android application, click on the Android icon:
5. To register your app on Firebase project, enter the android package name, the package name is same as what you entered while creating a new Flutter project:
If you don’t remember the package name, it can be found from
android > app > build.gradle > applicationId
6. Make sure you enter the package name correctly. App nickname and debug signing certificate can be left blank. Then register the app.
7. Next step is to download the googleServices.json and add it to
android > app directory of your project.
8. Now as per the instructions on the Firebase console, edit build.gradle files
Wohooo!!! Your Flutter app is connected to Firebase project. There are many benefits of using Firebase as a back end which will be covered in the upcoming articles. Till then stay tuned :)