You may already be familiar with adding Firebase ???? to your project, or you may not even know how to implement it. You can be certain of one thing: it takes longer than a minute. However, what if I told you that it only takes a few seconds to add Firebase to any Flutter project, new or old? ???? It seems too wonderful to be true, doesn’t it? I’ll show it to you, so bear with me!
Install Firebase CLI
Make sure the Firebase CLI is installed on your computer before continuing. If not, you can install it worldwide by just running the following command:
npm install -g firebase-tools
curl -sL https://firebase.tools | bash
firebase login
Let’s test it by the following command to display all the projects associated with your Firebase account:
firebase projects:list
Next activate the FlutterFire CLI by running the following command
dart pub global activate flutterfire_cli
If you are on Mac it may show you a warning ????
To solve this warning, First, you need to identify which shell you’re using.
echo $SHELL
The path to the shell you are now using, such as /bin/bash, /bin/zsh, or another shell, will be output by this command.
The configuration file will change depending on whatever shell you are using:
The configuration file for Bash is usually located at ~/.bashrc or ~/.bash_profile.
The configuration file for Zsh is located at ~/.zshrc.
You can use a text editor such as vim or nano now that you know the way. For instance, to edit the ~/.zshrc when using Zsh, type the following command:
nano ~/.zshrc
Add the path and save it
export PATH=”$PATH”: “$HOME/.pub-cache/bin”
Add Firebase to New or Existing Flutter App
You can choose to incorporate Firebase into an already-existing Flutter project or start a new one. I’ll walk through adding Firebase to the FlutterShop UI kit in this tutorial. With the more than 100 pre-built screens included in this UI kit, you can use Flutter to develop any kind of e-commerce application. Using FlutterShop will save you up to 70% of development time and give your app a polished look.