FlutterFire simplifies Firebase integration in Flutter apps, offering streamlined authentication and Firestore database operations through a clean and intuitive API.
Package selection guidance compiled from public package information, community data, and project usage.
FireFlutterDB is a Flutter package that simplifies integration with Firebase, providing an intuitive API for authentication and Firestore database operations. It streamlines common tasks like user sign-in, data retrieval, and real-time updates across Android, iOS, Web, and macOS platforms. Designed for developers seeking seamless Firebase functionality without boilerplate code, it enhances productivity and reduces setup complexity. The package is part of the broader FlutterFire ecosystem, ensuring compatibility and consistent design patterns.
Use cases
Real-time data syncing
User authentication workflows
Cross-platform app development
Cloud-based state management
Offline-first app features
Key features
Clean and intuitive API
Real-time Firestore listeners
Built-in authentication methods
Multi-platform support
Minimal boilerplate code
Suitable for
Beginner to intermediate Flutter developers
Apps requiring real-time data
Projects using Firebase as backend
Cross-platform mobile and web apps
Rapid prototyping
Considerations
Requires Firebase project setup
Limited to Firebase services
Dependent on FlutterFire ecosystem
May increase app size
Needs internet connection for cloud sync
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
FLUTTER FIRE 🔥
This Flutter package, named flutter_fire, provides convenient and streamlined access to Firebase Authentication and Firestore operations within your Flutter applications. It simplifies tasks such as user authentication via email/password and Google Sign-In, as well as common Firestore operations like retrieving single documents, fetching all documents in a collection, and streaming data updates. With its intuitive methods, flutter_fire aims to enhance your development experience by seamlessly integrating Firebase services into your Flutter projects.
Features
Authentication:
Sign in with email and password.
Create a new user with email and password.
Sign in with Google authentication.
Firebase Firestore Operations:
Find a single document by ID.
Find all documents in a collection.
Get a stream of data from a Firestore collection.
Retrieve data from a Firestore collection.
Find a list of documents present in a list of document IDs and return them as a stream.
Convenience Features:
Access to the current user.
Stream for authentication state changes.
Getting started
Prerequisites
Flutter Setup: Ensure you have Flutter installed on your system. You can find installation instructions on the official Flutter website.
Firebase Account: Create a Firebase account if you haven't already. You can sign up for free on the Firebase website.
@echo off
echo Firebase Login checking...
call firebase login
echo Adding Firebase plugins to the Flutter project...
call firebase init
echo Adding Firebase plugins to the Flutter project...
call flutter pub add firebase_core firebase_auth cloud_firestore
echo Running Flutter project...
call flutter run
To use this script, create a new text file in your project directory, name it firebase_init.bat, and paste the above code into it. Then, you can simply run this file from the command line to set up Firebase and add the necessary plugins to your Flutter project. Make sure you have both the Firebase CLI and Flutter installed and configured on your system before running this script.
Usage
import'package:flutter_fire/flutter_fire.dart';
1. Authentication :
// Initialize FlutterFire instanceFlutterFire flutterFire = FlutterFire();
// Sign in with email and passwordawait flutterFire.signInWithEmailAndPassword(email: 'example@email.com', password: 'password');
// Create a new user with email and passwordawait flutterFire.createUserWithEmailAndPassword(email: 'newuser@email.com', password: 'newpassword');
// Sign in with Google authenticationawait flutterFire.signInWithGoogle();
2. Firestore Operations :
// Get a single document by IDMap<String, dynamic>? document = await flutterFire.findOne('collectionName', 'documentId');
// Get all documents in a collectionList<dynamic>? documents = await flutterFire.findAll('collectionName');
// Stream data from a Firestore collectionStream<QuerySnapshot<Map<String, dynamic>>> stream = flutterFire.getStreamData('collectionName');
// Retrieve data from a Firestore collectionMap<String, dynamic> data = flutterFire.getData('collectionName');
// Find documents present in a list of document IDs and return them as a streamStream<List<Map<String, dynamic>>> docStream = flutterFire.findStreamContainingList('collectionName', 'documentId', ['id1', 'id2']);
3. Convenience Features:
// Access the current userUser? currentUser = flutterFire.currentUser;
// Stream for authentication state changesStream<User?> authStream = flutterFire.authStateChanges;
These examples showcase how to perform common authentication and Firestore operations using the flutter_fire package, making it easier for developers to integrate Firebase services into their Flutter applications.