Flutter Firebase Integration Guide
i am going to create a flutter app with firebase integration
help
Absolutely! Here's a clear roadmap to help you create a Flutter app integrated with
Firebase, step by step. We’ll cover:
✅ 1. Setup Prerequisites
Make sure you have these installed:
Flutter SDK
Android Studio or VS Code
Firebase account
A Firebase project created at [Link]
✅ 2. Create Your Flutter Project
bash
flutter create your_app_name
cd your_app_name
✅ 3. Add Firebase to Your Project
🔹 a. Install FlutterFire CLI
bash
dart pub global activate flutterfire_cli
🔹 b. Configure Firebase with Flutter
1/18
bash
flutterfire configure
Choose your Firebase project.
Select platforms (Android, iOS, Web).
It will auto-generate a firebase_options.dart file.
✅ 4. Add Firebase Packages
In [Link] , add:
yaml
dependencies:
firebase_core: ^2.31.0
firebase_auth: ^4.17.0 # For auth (optional)
cloud_firestore: ^5.8.0 # For Firestore (optional)
firebase_storage: ^11.6.0 # For image uploads (optional)
firebase_messaging: ^15.7.0 # For push notifications (optional)
Then run:
bash
flutter pub get
✅ 5. Android Firebase Setup
🔹 a. Add Android app in Firebase console
Package name: (e.g., [Link].your_app_name )
Download [Link]
Place it in:
bash
2/18
android/app/[Link]
🔹 b. Edit android/[Link]
gradle
buildscript {
dependencies {
classpath '[Link]:google-services:4.4.0'
}
}
🔹 c. Edit android/app/[Link]
gradle
apply plugin: '[Link]-services'
android {
compileSdkVersion 34
...
}
✅ 6. Initialize Firebase in Flutter
In [Link] :
dart
import 'package:flutter/[Link]';
import 'package:firebase_core/firebase_core.dart';
import 'firebase_options.dart';
void main() async {
[Link]();
await [Link](
options: [Link],
);
3/18
runApp(MyApp());
}
✅ 7. Run the App
bash
flutter run
You should now see your app running and connected to Firebase 🎉
✅ 8. Add Features (Optional)
You can now use:
firebase_auth for login/signup
cloud_firestore for realtime DB
firebase_storage for file uploads
firebase_messaging for notifications
Would you like help implementing a specific feature like login, Firestore DB, file upload, or
push notifications next?
Let me know your app idea, and I can scaffold the full feature for you.
Microsoft Windows [Version 10.0.26100.4652]
(c) Microsoft Corporation. All rights reserved.
C:\Users\sec-gen\OneDrive\Desktop\flutter\authlogin>dart
pub global activate flutterfire_cli
Downloading packages... (1.8s)
+ ansi_styles 0.3.2+1
4/18
+ args 2.7.0
+ async 2.13.0
+ characters 1.4.1
+ checked_yaml 2.0.4
+ ci 0.1.0
+ cli_util 0.4.2
+ clock 1.1.2
+ collection 1.19.1
+ dart_console 1.2.0 (4.1.2 available)
+ deep_pick 1.1.0
+ ffi 2.1.4
+ file 7.0.1
+ flutterfire_cli 1.3.1
+ http 1.4.0
+ http_parser 4.1.2
+ interact 2.2.0
+ intl 0.18.1 (0.20.2 available)
+ json_annotation 4.9.0
+ meta 1.17.0
+ path 1.9.1
+ petitparser 7.0.0
+ platform 3.1.6
+ process 5.0.4
+ pub_semver 2.2.0
+ pub_updater 0.5.0
+ pubspec_parse 1.5.0
+ source_span 1.10.1
+ string_scanner 1.4.1
+ term_glyph 1.2.2
+ tint 2.0.1
+ typed_data 1.4.0
+ web 1.1.1
+ win32 5.14.0
+ xml 6.6.0
+ yaml 3.1.3
Building package executables... (8.4s)
Built flutterfire_cli:flutterfire.
Installed executable flutterfire.
Warning: Pub installs executables into C:\Users\sec-
gen\AppData\Local\Pub\Cache\bin, which is not on your
path.
You can fix that by adding that directory to your system's
5/18
"Path" environment variable.
A web search for "configure windows path" will show you
how.
Activated flutterfire_cli 1.3.1.
C:\Users\sec-
gen\OneDrive\Desktop\flutter\authlogin>flutterfire
configure
'flutterfire' is not recognized as an internal or external
command,
operable program or batch file.
Great progress! You've successfully installed flutterfire_cli , but Windows can't recognize
the flutterfire command yet because its location isn't in your system's PATH.
🔧 Fix: Add Dart's Pub\Cache\bin folder to your System PATH
✅ Step-by-Step for Windows:
1. Find your executable path:
From the message:
pgsql
C:\Users\sec-gen\AppData\Local\Pub\Cache\bin
2. Add to System PATH:
Press Windows Key → search for Environment Variables → open "Edit the system
environment variables"
In System Properties, click on Environment Variables
In User variables section, find and select Path , then click Edit
Click New and paste:
pgsql
C:\Users\sec-gen\AppData\Local\Pub\Cache\bin
Click OK, and again OK to close all dialogs
3. Restart your terminal (important):
Close and reopen Command Prompt or PowerShell or your IDE Terminal
6/18
4. Verify the flutterfire command:
bash
flutterfire --version
You should see output like:
nginx
flutterfire_cli 1.3.1
5. Now you can run:
bash
flutterfire configure
Would you like me to walk you through the flutterfire configure process once it’s
working?
path added still show unknown
Got it — let's fix this quickly. If you've added the path but flutterfire still shows as
unknown, follow this troubleshooting checklist:
✅ 1. Confirm Executable Exists
First, check if [Link] actually exists:
Open Command Prompt and run:
cmd
dir "C:\Users\sec-gen\AppData\Local\Pub\Cache\bin"
7/18
You should see:
[Link]
If it's missing, re-run:
bash
dart pub global activate flutterfire_cli
✅ 2. Try Running Directly with Full Path
Try this command:
bash
C:\Users\sec-gen\AppData\Local\Pub\Cache\bin\[Link] configure
If this works, your PATH is likely not applied yet.
✅ 3. Make Sure You Restarted the Terminal or System
After changing the Path , restart your terminal or PC completely.
Then try:
bash
flutterfire --version
Still doesn’t work?
✅ 4. Add PATH Using Command Prompt (Force Refresh)
Run this command to check if flutterfire is in the current PATH:
8/18
cmd
echo %PATH%
Do you see:
pgsql
C:\Users\sec-gen\AppData\Local\Pub\Cache\bin
If not, run:
cmd
setx PATH "%PATH%;C:\Users\sec-gen\AppData\Local\Pub\Cache\bin"
Then restart Command Prompt.
✅ 5. Final Alternative: Use PowerShell to Run It
If CMD doesn’t work, try this in PowerShell:
powershell
[Link] configure
or
powershell
& "C:\Users\sec-gen\AppData\Local\Pub\Cache\bin\[Link]" configure
✅ 6. (Optional) Use in VS Code Terminal
If you use VS Code, restart it and try in the terminal:
bash
9/18
flutterfire configure
Let me know which step worked, or share the result of:
bash
dir "C:\Users\sec-gen\AppData\Local\Pub\Cache\bin"
I’ll guide you based on what you see.
C:\Users\sec-
gen\OneDrive\Desktop\flutter\authlogin>C:\Users\sec-
gen\AppData\Local\Pub\Cache\bin\[Link] configure
i Found 0 Firebase projects.
Failed to fetch your Firebase projects. Fetch failed with this:
FirebaseCommandException: An error occured on the
Firebase CLI when attempting to run a command.
COMMAND: firebase --version
ERROR: The FlutterFire CLI currently requires the official
Firebase CLI to also be installed, see
[Link]
for how to install it.
✔ Would you like to create a new Firebase project? · yes
✘ Firebase project ids must be lowercase and contain only
alphanumeric and dash characters.
? Enter a project id for your new Firebase project (e.g. my-
cool-project) ›
Perfect — now we're getting somewhere! 🚀
The error message you're seeing is normal and expected when the Firebase CLI is not
installed.
10/18
✅ Here's What’s Happening:
You successfully ran flutterfire configure using the full path 👏
But it now says:
"The FlutterFire CLI currently requires the official Firebase CLI to also be installed"
🔧 Solution: Install Firebase CLI (Required by FlutterFire)
🔹 Step 1: Install [Link] (if not already installed)
Firebase CLI is built on [Link].
Download and install it from:
🔗 [Link]
👉 Download the LTS version (recommended).
After installation, run:
bash
node -v
npm -v
🔹 Step 2: Install Firebase CLI via npm
Open Command Prompt and run:
bash
npm install -g firebase-tools
This installs the firebase command globally.
Verify:
bash
firebase --version
11/18
You should see a version like:
13.x.x
🔹 Step 3: Authenticate Firebase CLI
Run:
bash
firebase login
A browser window will open — login with your Firebase Google account.
🔹 Step 4: Run flutterfire configure again
Now that firebase is installed and authenticated, you can finally run:
bash
flutterfire configure
It should now detect your Firebase projects or let you create one properly.
Let Me Know:
Do you want help choosing Firestore vs Realtime DB?
Want me to generate the boilerplate Firebase Auth or Firestore code for your app?
I’m ready to help you with the next step in your Flutter + Firebase project!
12/18
C:\Users\sec-
gen\OneDrive\Desktop\flutter\authlogin>C:\Users\sec-
gen\AppData\Local\Pub\Cache\bin\[Link] configure
i Found 0 Firebase projects.
Failed to fetch your Firebase projects. Fetch failed with this:
FirebaseCommandException: An error occured on the
Firebase CLI when attempting to run a command.
COMMAND: firebase --version
ERROR: The FlutterFire CLI currently requires the official
Firebase CLI to also be installed, see
[Link]
for how to install it.
✔ Would you like to create a new Firebase project? · yes
✔ Enter a project id for your new Firebase project (e.g. my-
cool-project) · 1234
FirebaseCommandException: An error occured on the
Firebase CLI when attempting to run a command.
COMMAND: firebase --version
ERROR: The FlutterFire CLI currently requires the official
Firebase CLI to also be installed, see
[Link]
for how to install it.
C:\Users\sec-gen\OneDrive\Desktop\flutter\authlogin>
Thanks for the update — you're right on the edge of success 💪
The error confirms that the problem is:
✅ Firebase CLI is not installed on your system.
🔧 Solution: Install the Firebase CLI Properly
You need to install the official Firebase CLI, which is separate from flutterfire_cli .
✅ Step-by-Step Guide to Fix It
13/18
🔹 Step 1: Install [Link] (if not already)
Go to: 👉 [Link]
Download the LTS version
Install it (default options)
Then verify it works:
bash
node -v
npm -v
🔹 Step 2: Install Firebase CLI via npm
Now run this command in Command Prompt (as Admin is preferred):
bash
npm install -g firebase-tools
After it's done, confirm:
bash
firebase --version
You should see a version like 13.x.x
🔹 Step 3: Login to Firebase
bash
firebase login
It will open a browser — sign in with your Google account.
14/18
🔹 Step 4: Run FlutterFire Configure Again
bash
flutterfire configure
Now it should either:
Detect your existing Firebase project, or
Let you create one successfully
✅ Bonus Tip: Use These Tools to Check Everything
firebase --version → Confirms Firebase CLI is installed
flutterfire --version → Confirms FlutterFire CLI is working
flutter doctor → To confirm Flutter setup
Let me know once firebase --version works.
Then I’ll help you connect it to Android or iOS with Firebase Auth, Firestore, or any feature
you want.
Waiting for authentication...
+ Success! Logged in as rdhobe8@[Link]
C:\Users\sec-
gen\OneDrive\Desktop\flutter\authlogin>flutterfire
configure
'flutterfire' is not recognized as an internal or external
command,
operable program or batch file.
C:\Users\sec-gen\OneDrive\Desktop\flutter\authlogin>
15/18
You're logged in — great! Now run this command using the full path since flutterfire still
isn’t recognized globally:
bash
C:\Users\sec-gen\AppData\Local\Pub\Cache\bin\[Link] configure
This will now work since Firebase CLI is installed and authenticated. Let me know if you want
help linking Android or setting up Firestore/Auth.
2/2
configred
🎉 Awesome — Firebase is now successfully configured with your Flutter app!
Now that you've done flutterfire configure , your project should have a new file:
bash
lib/firebase_options.dart
This contains the platform-specific Firebase config.
✅ What's Next?
Let’s set up Firebase in your Flutter app now:
🔹 1. Add Firebase Packages in [Link]
yaml
dependencies:
firebase_core: ^2.31.0
firebase_auth: ^4.17.0 # For login/signup (optional)
cloud_firestore: ^5.8.0 # For NoSQL database (optional)
firebase_storage: ^11.6.0 # For image/files (optional)
Then run:
bash
16/18
flutter pub get
🔹 2. Initialize Firebase in [Link]
dart
import 'package:flutter/[Link]';
import 'package:firebase_core/firebase_core.dart';
import 'firebase_options.dart';
void main() async {
[Link]();
await [Link](
options: [Link],
);
runApp(MyApp());
}
🔹 3. Test Your Setup
Add this dummy widget:
dart
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Firebase App',
home: Scaffold(
appBar: AppBar(title: Text('Firebase Connected')),
body: Center(child: Text('Firebase initialized successfully')),
),
);
}
}
17/18
Run it:
bash
flutter run
If the app launches with no error — 🎯 you're ready to build features!
🚀 Next Steps (Choose What You Want to Add)
What do you want to build next?
1. 🔐 Firebase Authentication (Login/Signup)
2. 📄 Firestore Database (Store user data)
3. 🖼️ Firebase Storage (Upload images/files)
4. 🔔 Push Notifications (FCM)
5. 🌐 Connect Flutter Web with Firebase
Let me know and I’ll build out the code for you step by step!
18/18