FlutterFire Tutorial [2024]🔥

Priyanshu SidarPriyanshu Sidar
2 min read

For those who don't know FlutterFire is a Firebase plugins for Flutter.

🤓 Firebase provides a set of backend computing services for app development.

Firebase CLI setup

First if you already haven't , set up Firebase CLI on your device:

If you have npm run the following command :

npm install -g firebase-tools

After installation of Firebase CLI run the following command to login:

firebase login

If don't have npm follow the following documentation:

Follow this documentation

Creating a new Firebase Project

  1. Go to your firebase console on your browser

  2. Add a new project with <Project-Name>

  3. For android app :

    A) Click on the android icon that you will be asked to register your app

    B) fill the name same as that given in the namespace option in your \>Project>android>app>build.gradle file

    C) For the Next Step you have to download the google-service.json file and paste in \>Project>android>app Folder

    D) After this add all the necessary dependencies as directed.

  4. Now in your flutter project add this add firebase core package :

    flutter pub add firebase_core

  5. Add the following code in main function :

     Future<void> main() async {
       WidgetsFlutterBinding.ensureInitialized();
       await Firebase.initializeApp()
       runApp(const Home());
     }
    

    Also import the flutter_core package

  6. Now try to run the app if it runs successfully than than your are ready to move to use all the firebase services.

Now lets see how to add authentication using firebase in the next tutorial : Link

Connect with me on socials and lets learn together:

0
Subscribe to my newsletter

Read articles from Priyanshu Sidar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Priyanshu Sidar
Priyanshu Sidar