Quick Set-Up- Integrating Flutter Android App With Firebase
Flutter and Firebase works together to help you to build mobile applications in record time. Flutter is Google’s SDK for creating mobile apps for iOS and Android device. Firebase works as a backend for mobile apps. It gives you facilities like authentication, database, storage, hosing and many more without maintaining your own server.
Prerequisite : Existing flutter app in which user want to integrate firebase, If yes then start follow from step 2. Otherwise,
Step 1. Create new flutter project in Android Studio
Give name for flutter app
set company domain for your app
then click on Finish
Here is flutter app created.
Step 2. Now come to firebase, Don’t have an account then create one. It’s free.
Step 3. Login to your firebase account -> Go to console
click on Add Project
Give the name for project, This can be a different name from flutter app name. Must be meaningful to flutter app, so that in future if required, user can refer it.
Click on Continue button.
just select for Google analytics for my project. This is optional you can set it later on also and click on Continue and pass through this screen.
Select Default Account for Firebase and click on Create Project.
Click on Continue button.
Step 4. Now to add android flutter app click on android symbol(circled with red)
Enter android package name. This should be match with your flutter app package name.
Find it from flutter app,
appname->android->app->build.gradle file(highlighted package name)
copy it and paste it here.
click on Register app.
Step 5. Now click on Download google-service.json button. This file stored in Downloads folder of your system. and then click on next button.
Step 6. Copy this file under Appname->android->app folder
Step 7. Now on firebase console, got a prompt to add firebase SDK
open project level build.gradle and copy below lines.
Step 8. open app level build.gradle file and copy below lines
Step 9. click on next button from firebase console
Step 10. click on continue to console
just run your app. Remember while doing firebase connection your app must be stopped.
Congratulations you successfully added your flutter app to firebase !!!
View source code here
How to create collection and access data from Cloud Firestore, please refer
Access Data from Cloud Firestore
Thank you!