How to Connect Firebase in Flutter, install Firebase CLI for window /Mac

Hasnain Mirrani
4 min readAug 8, 2023

--

step 1

Git hub File link =>

Fiver id=> https://www.fiverr.com/hmirrani

create project

Step 2

select Flutter logo for start connectivity with firebase Cli

click on firebase cli
click on windows platform and download Cli File and install it
file is downloading
click on downloaded file
start initlzing firebase cli write “ y ” for yes
Allow the access it will open browser for login Cli firebaseId
login with firebase id
it will show login success in command line you can check

step 3 install node js

now download and intalll node js

After installing node js run the command on CMD command line

npm install -g firebase-tools
after run this npm tool command
copy the first line and run on cmd command line
paste the copy command on cmd and run

After paste the command and run the code it will download all type of required file

Step 4

Go to C/: user => and so on

C:\Users\Hasnain\AppData\Local\Pub\Cache\bin

add into environment variable

copy this path
set the environment variable
come on firebase cli and copy 2nd command

come on your project root directory and write “cmd” it will open terminal on this path

write cmd on path

when open terminal than paste command over there

paste firebase cli 2nd command and run it will ask for platform pres just “Enter
go to next

Step 5: install firebase core in pubspect.

https://pub.dev/packages/firebase_core

or add $ flutter pub add firebase_core

add this plugin

Come on main.dart file and paste this code

await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);

write code
import libraries you can see this file auto create after this process

Finished finally you can see on firebase dashboard all platform added

Successfully Added

For Mac users:

How install for in Mac

write command for check firebase login

after done cli insatll and firebase login go to next and

copy this command

after run this and you get the path and copy this path and again paste and press enter

copy 2nd command and paste in project terminal and run

Done Success fully insalled

--

--

Hasnain Mirrani

Update the lattest and well explain All about Flutter make you from Zero to Hero in Flutter. follow https://www.linkedin.com/in/hasnain-mirrani-b47ab7131