• Kalyan K Mohanty

Firebase Integration with flutter

Flutter is a hybrid mobile application platform, but I'm only going to use it on Android devices for this post. The article is all about using Firebase real-time database in Flutter, as well as I'm not going to go into detail about Flutter.

Firebase Implementation in Flutter.

So first you need to have Flutter on your operating system already installed. I'm not going to go into it but this is where you can check how to install Flutter. Open Visual Studio Code now and run the command below:

 flutter create firebase_with_flutter

A new project called firebase with flutter will be generated with this instruction. Then, to go to the project directory, do the following:

 cd firebase_with_flutter
 code .

Now you can see a new application created on your computer if you run Flutter run. We are now beginning to incorporate Firebase into the project in the next process. So first, open the Firebase console and build a new project, and then you can click the Android icon to start adding project-related information. Now, you need to get the name of the kit that can be found under the following.

path android\app\src\main\AndroidManifest.xml:

 <manifest xmlns:android=""

download the Firebase Android config file google-services.json and paste it under android/app. Now to navigate, you need to the android/build.gradle and add the google maven repository and the google-services classpath:

 buildscript {
 repositories {
 // Check that you have the following line (if not, add it):
 google() // Google's Maven repository
  dependencies {
  // Add this line
  classpath ''
  allprojects {
  repositories {
  // Check that you have the following line (if not, add it):
  google() // Google's Maven repository

Then add the following: inside your android app\app\build.gradle:

You can now easily use your project's real-time Firebase database!

Save to Firebase Data

You should use the following plugins to be able to call up a Firebase SDK. Within pubspec.yaml, then, add the following:

   firebase_core: ^0.5.0+1
   firebase_database: ^4.1.1

Visual studio code can execute flutter packages get and connect the plugin to your project by pressing CTRL+S and save. In order to use some firebase services, you must also add the firebase core dependency.

Therefore, because all firebase dependencies rely on the firebase core you need to initialize Firebase to be able to call any method related to real-time database, firestore, authentication, etc. For instance:

void main() async { 
await Firebase.initializeApp();


23 views0 comments

Recent Posts

See All