blender-motion-state-inspection
AFaffaan-m/ECC314k近 7 天新增 3,503 个 star
Use when adding Firebase to a Flutter project, running flutterfire configure, initializing Firebase in main.dart, or configuring multiple flavors.
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:
npm install -g firebase-tools
firebase login
dart pub global activate flutterfire_cli
Minimum platform requirements:
# 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.import '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):
flutterfire 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:
// 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);
}
// main.dart
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await initializeFirebaseApp();
runApp(const MainApp());
}
appFlavor or environment variables to select the configuration at runtime.as dev).AFaffaan-m/ECC314k近 7 天新增 3,503 个 star
ANanthropics/skills203k近 7 天新增 2,822 个 star
HAharry0703/MoneyPrinterTurbo147k近 7 天新增 1,401 个 star
SHShubhamsaboo/awesome-llm-apps146k近 7 天新增 818 个 star
GAgarrytan/gstack143k近 7 天新增 524 个 star