Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Use when adding Firebase to a Flutter project, running flutterfire configure, initializing Firebase in main.dart, or configuring multiple flavors.
.claude/skills/evanca-flutterfire-configure/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-04 | ✗→✓ | ▲ Improved | -5% | 0% |
| case-01 | ✗→✓ | ▲ Improved | 11% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 15% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 1% | 0% |
| case-14 | ✗→✓ | ▲ Improved | -6% | 0% |
This skill defines how to correctly set up and configure Firebase for Flutter applications.
Use this skill when:
flutterfire configure after adding a new Firebase service or platform.main.dart.Install the required tools:
bashnpm install -g firebase-tools firebase login dart pub global activate flutterfire_cli
Minimum platform requirements:
bash# From your Flutter project directory: flutterfire configure # Add the core Firebase package: flutter pub add firebase_core
flutterfire configure any time you add support for a new platform or start using a new Firebase service.flutter run after adding new Firebase plugins.dartimport 'package:firebase_core/firebase_core.dart'; import 'firebase_options.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp( options: DefaultFirebaseOptions.currentPlatform, ); runApp(const MyApp()); }
WidgetsFlutterBinding.ensureInitialized() before Firebase initialization.firebase_options.dart manually — it is auto-generated.firebase_options.dart to version control — it contains non-secret configuration identifiers.await Firebase.initializeApp(demoProjectId: "demo-project-id").After configuration, verify the setup is working:
flutter run and confirm the app launches without Firebase initialization errors.Firebase initialized successfully or similar confirmation.firebase_options.dart was generated with the correct project ID.Create separate Firebase projects per environment (development, staging, production):
bashflutterfire config \ --project=flutter-app-dev \ --out=lib/firebase_options_dev.dart \ --ios-bundle-id=com.example.flutterApp.dev \ --ios-out=ios/flavors/dev/GoogleService-Info.plist \ --android-package-name=com.example.flutter_app.dev \ --android-out=android/app/src/dev/google-services.json
Centralize Firebase initialization by flavor:
dart// firebase.dart import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/services.dart'; import 'package:flutter_app/firebase_options_prod.dart' as prod; import 'package:flutter_app/firebase_options_stg.dart' as stg; import 'package:flutter_app/firebase_options_dev.dart' as dev; Future<void> initializeFirebaseApp() async { final firebaseOptions = switch (appFlavor) { 'prod' => prod.DefaultFirebaseOptions.currentPlatform, 'stg' => stg.DefaultFirebaseOptions.currentPlatform, 'dev' => dev.DefaultFirebaseOptions.currentPlatform, _ => throw UnsupportedError('Invalid flavor: $appFlavor'), }; await Firebase.initializeApp(options: firebaseOptions); }
dart// main.dart void main() async { WidgetsFlutterBinding.ensureInitialized(); await initializeFirebaseApp(); runApp(const MainApp()); }
appFlavor or environment variables to select the configuration at runtime.as dev).Other measured skills in the registry, with their headline benchmark lift.