firebase
Flutter + Dart boilerplate for agentic multi-platform apps with Riverpod, GraphQL, gRPC, and spec-driven AI development
Install / Use
npx skills add chimeranext/flutter-boilerplate-monorepo-templateInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
Development & EngineeringSupported Platforms
Skill content
View source on GitHub🔥 Skill: Firebase Integration
📋 Metadata
| Atributo | Valor |
|----------|-------|
| ID | flutter-firebase |
| Nivel | 🟡 Intermedio |
| Versión | 2.0.0 |
| Keywords | firebase, firestore, auth, cloud-messaging, analytics, storage, remote-config, crashlytics, provider |
| Referencia | FlutterFire |
🔑 Keywords para Invocación
firebasefirestorefirebase-authcloud-messagingfirebase-analyticsfirebase-storagefirebase-remote-configfirebase-crashlyticsprovider@skill:firebase
Ejemplos de Prompts
Integra Firebase con auth y Firestore
Implementa Firebase Authentication y Cloud Messaging
@skill:firebase - Configura Firebase completo
📖 Descripción
Firebase Integration proporciona servicios backend completos: Authentication (Email/Password y Google Sign-In), Firestore Database, Cloud Storage, Push Notifications (FCM), Analytics (con tracking de screens, eventos personalizados, user ID y propiedades), Crashlytics y Remote Config. Incluye integración con Provider para state management y configuración multiplataforma con mejores prácticas.
⚠️ IMPORTANTE: Todos los comandos de este skill deben ejecutarse desde la raíz del proyecto (donde existe el directorio mobile/). El skill incluye verificaciones para asegurar que se está en el directorio correcto antes de ejecutar cualquier comando.
⚠️ IMPORTANTE: Todos los comandos de este skill deben ejecutarse desde la raíz del proyecto (donde existe el directorio mobile/). El skill incluye verificaciones para asegurar que se está en el directorio correcto antes de ejecutar cualquier comando.
✅ Cuándo Usar Este Skill
- Backend as a Service rápido
- Authentication con múltiples providers
- Base de datos en tiempo real
- Push notifications
- Analytics y Crashlytics
- Remote Config para A/B testing
- Rapid prototyping
❌ Cuándo NO Usar Este Skill
- Requieres control total del backend
- Costos de Firebase son prohibitivos
- Backend custom ya existe
🏗️ Estructura del Proyecto
lib/
├── core/
│ ├── firebase/
│ │ ├── firebase_options.dart (generado)
│ │ ├── firebase_config.dart
│ │ └── firebase_initialization.dart
│ └── services/
│ ├── analytics_service.dart
│ ├── crashlytics_service.dart
│ ├── remote_config_service.dart
│ └── storage_service.dart
│
├── features/
│ ├── authentication/
│ │ ├── data/
│ │ │ ├── datasources/
│ │ │ │ └── firebase_auth_datasource.dart
│ │ │ └── repositories/
│ │ │ └── auth_repository_impl.dart
│ │ ├── domain/
│ │ │ ├── entities/
│ │ │ │ └── user.dart
│ │ │ └── repositories/
│ │ │ └── auth_repository.dart
│ │ └── presentation/
│ │ ├── screens/
│ │ │ └── login_screen.dart
│ │ ├── providers/
│ │ │ └── auth_provider.dart
│ │ └── bloc/
│ │ └── auth_bloc.dart
│ │
│ ├── products/
│ │ ├── data/
│ │ │ ├── datasources/
│ │ │ │ └── firestore_products_datasource.dart
│ │ │ └── models/
│ │ │ └── product_model.dart
│ │ └── domain/
│ │ └── entities/
│ │ └── product.dart
│ │
│ └── notifications/
│ ├── data/
│ │ ├── datasources/
│ │ │ └── fcm_datasource.dart
│ │ └── services/
│ │ └── notification_service.dart
│ └── presentation/
│ └── screens/
│ └── notifications_screen.dart
│
└── main.dart
📦 Dependencias Requeridas
dependencies:
flutter:
sdk: flutter
# Firebase Core
firebase_core: ^2.24.2
# Firebase Authentication
firebase_auth: ^4.15.3
google_sign_in: ^6.2.1
# Cloud Firestore
cloud_firestore: ^4.13.6
# Cloud Storage
firebase_storage: ^11.5.6
# Cloud Messaging
firebase_messaging: ^14.7.9
flutter_local_notifications: ^16.3.0
# Firebase Analytics
firebase_analytics: ^10.7.4
# Crashlytics
firebase_crashlytics: ^3.4.8
# Remote Config
firebase_remote_config: ^4.3.8
# State Management
provider: ^6.1.1
# Image Picker (para Storage)
image_picker: ^1.0.7
# Utils
equatable: ^2.0.5
dartz: ^0.10.1
dev_dependencies:
flutter_test:
sdk: flutter
⚙️ Configuración Inicial
1. Firebase CLI Setup
# Instalar Firebase CLI
npm install -g firebase-tools
# Login a Firebase
firebase login
# Verificar que estamos en la raíz del proyecto
if [ ! -d "mobile" ]; then
echo "Error: Ejecuta este comando desde la raíz del proyecto"
exit 1
fi
# Instalar FlutterFire CLI
dart pub global activate flutterfire_cli
# Configurar Firebase para el proyecto
cd mobile
flutterfire configure
cd ..
flutterfire configure
2. Android Configuration
// android/build.gradle
buildscript {
dependencies {
classpath 'com.google.gms:google-services:4.4.0'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.9'
}
}
// android/app/build.gradle
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
android {
defaultConfig {
minSdkVersion 21 // Firebase requires 21+
}
}
3. iOS Configuration
# ios/Podfile
platform :ios, '13.0' # Firebase requires 13.0+
# Después de flutter_install_all_ios_pods
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
end
end
end
💻 Implementación
1. Firebase Initialization
// lib/main.dart
import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'firebase_options.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
// Initialize Firebase
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
// Pass all uncaught errors to Crashlytics
FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterFatalError;
runApp(const MyApp());
}
2. Firebase Authentication
// lib/features/authentication/data/datasources/firebase_auth_datasource.dart
import 'package:firebase_auth/firebase_auth.dart' as firebase_auth;
import 'package:google_sign_in/google_sign_in.dart';
import '../models/user_model.dart';
abstract class FirebaseAuthDataSource {
Stream<UserModel?> get authStateChanges;
Future<UserModel> signInWithEmailAndPassword(String email, String password);
Future<UserModel> signUpWithEmailAndPassword(String email, String password);
Future<UserModel> signInWithGoogle();
Future<void> signOut();
Future<void> sendPasswordResetEmail(String email);
UserModel? getCurrentUser();
}
class FirebaseAuthDataSourceImpl implements FirebaseAuthDataSource {
final firebase_auth.FirebaseAuth _firebaseAuth;
final GoogleSignIn _googleSignIn;
FirebaseAuthDataSourceImpl({
firebase_auth.FirebaseAuth? firebaseAuth,
GoogleSignIn? googleSignIn,
}) : _firebaseAuth = firebaseAuth ?? firebase_auth.FirebaseAuth.instance,
_googleSignIn = googleSignIn ?? GoogleSignIn();
@override
Stream<UserModel?> get authStateChanges {
return _firebaseAuth.authStateChanges().map((firebaseUser) {
return firebaseUser != null ? UserModel.fromFirebaseUser(firebaseUser) : null;
});
}
@override
Future<UserModel> signInWithEmailAndPassword(
String email,
String password,
) async {
try {
final credential = await _firebaseAuth.signInWithEmailAndPassword(
email: email,
password: password,
);
if (credential.user == null) {
throw Exception('Sign in failed');
}
return UserModel.fromFirebaseUser(credential.user!);
} on firebase_auth.FirebaseAuthException catch (e) {
throw _handleAuthException(e);
}
}
@override
Future<UserModel> signUpWithEmailAndPassword(
String email,
String password,
) async {
try {
final credential = await _firebaseAuth.createUserWithEmailAndPassword(
email: email,
password: password,
);
if (credential.user == null) {
throw Exception('Sign up failed');
}
return UserModel.fromFirebaseUser(credential.user!);
} on firebase_auth.FirebaseAuthException catch (e) {
throw _handleAuthException(e);
}
}
@override
Future<UserModel> signInWithGoogle() async {
try {
// Trigger the authentication flow
final GoogleSignInAccount? googleUser = await _googleSignIn.signIn();
if (googleUser == null) {
throw Exception('Google sign in was cancelled');
}
// Obtain the auth details from the request
final GoogleSignInAuthentication googleAuth = await googleUser.authentication;
// Create a new credential
final credential = firebase_auth.GoogleAuthProvider.credential(
accessToken: googleAuth.accessToken,
idToken: googleAuth.idToken,
);
// Sign in to Firebase with the Google credential
final userCredential = await _firebaseAuth.signInWithCredential(credential);
if (userCredential.user == null) {
throw Exception('Google sign in failed');
}
return UserModel.fromFirebaseUser(userCredential.user!);
} on firebase_auth.FirebaseAuthException catch (e) {
throw _handleAuthException(e);
} catch (e) {
throw Exception('Google sign in failed: $e');
}
}
@override
Future<void> signOut() async {
await Future.wait([
_firebaseAuth.signOut(),
_googleSignIn.signOut(),
]);
}
@override
Future<void> sendPasswordResetEmail(String email) async {
try {
await _firebaseAuth.sendPasswordResetEmail(email: email);
} on firebase_auth.FirebaseAuthException catch (e) {
throw _handleAuthException(e);
}
}
@override
UserModel? getCurrentUser() {
final firebaseUser = _firebaseAuth.currentUser;
return firebaseUser != null ? UserModel.fromFirebaseUser(firebaseUser) : null;
}
Exception _handleAuthException(firebase_auth.FirebaseAuthException e) {
switch (e.code) {
case 'user-not-found':
return Exception('No user found with this email');
case 'wrong-password':
return Exception('Wrong password');
case 'email-already-in-use':
return Exception('Email already in use');
case 'weak-password':
return Exception('Password is too weak');
case 'invalid-email':
return Exception('Invalid email format');
default:
return Exception('Authentication failed: ${e.message}');
}
}
}
3. Cloud Firestore
// lib/features/products/data/datasources/firestore_products_datasource.dart
import 'package:cloud_firestore/cloud_firestore.dart';
import '../models/product_model.dart';
abstract class FirestoreProductsDataSource {
Stream<List<ProductModel>> getProductsStream();
Future<List<ProductModel>> getProducts();
Future<ProductModel> getProduct(String id);
Future<ProductModel> createProduct(ProductModel product);
Future<ProductModel> updateProduct(ProductModel product);
Future<void> deleteProduct(String id);
}
class FirestoreProductsDataSourceImpl implements FirestoreProductsDataSource {
final FirebaseFirestore _firestore;
static const String _collection = 'products';
FirestoreProductsDataSourceImpl({FirebaseFirestore? firestore})
: _firestore = firestore ?? FirebaseFirestore.instance;
@override
Stream<List<ProductModel>> getProductsStream() {
return _firestore
.collection(_collection)
.orderBy('createdAt', descending: true)
.snapshots()
.map((snapshot) {
return snapshot.docs
.map((doc) =
Truncated for display — read the full file on GitHub.
Related Skills
career-ops
72.3kOpen-source AI job search: scan job portals, evaluate listings into a structured A-H report with a global 1-5 score, tailor your CV, track applications — runs locally in your AI coding CLI (Claude Code, Codex, OpenCode, Antigravity…)
ai-job-search
43.5kThe job search that runs on your machine. AI job application framework built on Claude Code: evaluate postings, tailor CVs, write cover letters, prep interviews. Fork it and own it.
claude-howto
41.6kA visual, example-driven guide to Claude Code — from basic concepts to advanced agents, with copy-paste templates that bring immediate value.
AstrBot
40.8kAI Agent Assistant & development framework that integrates lots of IM platforms, LLMs, plugins and AI feature, and can be your openclaw alternative. ✨
Security Score
Audited on Invalid Date
