Firebase
Firebase Setup (Flutter Project)
Step 1: Install Firebase CLI
Make sure you have Firebase CLI installed globally:
npm install -g firebase-tools
Then log in:
firebase login
Step 2: Install Flutter SDK
Ensure that Flutter SDK is installed and configured on your machine.
Verify with:
flutter doctor
Step 3: Create or Open Your Flutter Project
To create a new project:
flutter create your_project_name
Step 4: Install FlutterFire CLI
Run the following command:
dart pub global activate flutterfire_cli
Step 5: Configure Firebase with FlutterFire
Navigate to the root of your Flutter project and run:
flutterfire configure --project=your-firebase-project-id
Example:
flutterfire configure --project=***********
✅ This will automatically:
- Register your Android & iOS apps with Firebase
- Download configuration files automatically
- Generate
lib/firebase_options.dartin your project
Step 6: Initialize Firebase in Flutter
Add initialization code in your main.dart:
import 'package:firebase_core/firebase_core.dart';
import 'firebase_options.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
runApp(MyApp());
}
*If you found any error on this
Documentation then please contact me. Thank you*
*Good Luck*