Simplified Flutter firebase Project Setup with Firebase-CLI and FlutterFire: A Step-by-Step Tutorial

Stephanorazafindramena
3 min readDec 11, 2023

--

Hey folks! 🚀 Just dropped a new article on Flutter and Firebase! Learn how to set up your Flutter project in a snap using Firebase-CLI and FlutterFire-CLI. No more manual headaches 😤​

Prerequisites

  • Google Account: Essential for creating your Firebase projec
  • Firebase Tools: Make sure to have them installed on your machine.
  • Flutter sdk : Ensure you have Flutter installed to create your Flutter project

Step 1 : Creating Firebase Project

Go to firebase console (https://console.firebase.google.com) and create your project.

Step 2 : Installing cli tools

To use firebase cli we need to install the firebase tools in our machine, make sure you have node-js installed, using npm :

npm install -g firebase-tools

or downloading manually the firebase binary file (https://firebase.google.com/docs/cli?hl=fr#install-cli-windows) and drop it into your usr/local/bin directory on Linux or include it in your environment variables on Windows.

Next, install the FlutterFire CLI by running the following command:

dart pub global activate flutterfire_cli

Once installed, the flutterfire command will be globally available on your machine.

step 3 : configure flutter project

Once your Flutter project is ready, don’t forget to install the firebase_core plugin. Now, let's sync it with Firebase! Log in to your Firebase account on your machine by entering firebase login in the terminal, and select the account linked to your Firebase project.

Ready for the final touch? Execute flutterfire configure to effortlessly integrate Firebase with your project :

Select project to configure
Select the platform

All you need is to follow all the instruction prompted in the terminal.

If the configuration is successful, you’ll discover these generated files within your project :

firebase_options.dart inside the root folder
google-service.josn inside android/app
GoogleService-info.plist inside ios/Runner

Conclusion

In a nutshell, you’ve learned how to effortlessly link Firebase with your Flutter project using Firebase-CLI and FlutterFire. Just follow the steps from creating a Firebase project to configuring it in your Flutter app. Keep coding, and enjoy the seamless synergy of Flutter and Firebase! 🚀

--

--