搜尋套件、儲存庫與 APP 分類

套件詳情v0.0.1

fire_flutter_db

FlutterFire 透過簡潔直覺的 API 簡化了 Flutter 應用中的 Firebase 集成,提供流暢的驗證與 Firestore 資料庫操作。

AndroidiOSWebmacOS
近 30 天下載
29
喜歡數
7
Pub 分數
120

安裝套件

flutter pub add fire_flutter_db

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

FireFlutterDB 是一個 Flutter 套件,可簡化與 Firebase 的整合,提供直覺的 API 用於身分驗證及 Firestore 資料庫作業。它簡化了常見任務,例如使用者登入、資料檢索,以及在 Android、iOS、Web 和 macOS 平台上的即時更新。專為尋求無縫使用 Firebase 功能且無需冗長程式碼的開發者設計,可提升生產力並降低設定複雜度。此套件屬於更廣泛的 FlutterFire 生態系統,確保相容性與一致的設計模式。

適用情境

  • 即時資料同步
  • 使用者身分驗證工作流程
  • 跨平台應用開發
  • 基於雲的狀態管理
  • 離線優先應用功能

主要特色

  • 簡潔直覺的 API
  • 即時 Firestore 監聽器
  • 內建的驗證方法
  • 多平台支援
  • 最小化樣板程式碼

適合對象

  • 初學者到中級 Flutter 開發者
  • 需要即時資料的應用程式
  • 使用 Firebase 作為後端的專案
  • 跨平台行動與網頁應用程式
  • 快速原型設計

使用建議

  • 需要 Firebase 項目設定
  • 僅限 Firebase 服務
  • 依賴於 FlutterFire 生態系統
  • 可能增加應用大小
  • 需要網路連接以進行雲端同步

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

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

  1. Authentication:

    • Sign in with email and password.
    • Create a new user with email and password.
    • Sign in with Google authentication.
  2. 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.
  3. Convenience Features:

    • Access to the current user.
    • Stream for authentication state changes.

Getting started

Prerequisites
  1. Flutter Setup: Ensure you have Flutter installed on your system. You can find installation instructions on the official Flutter website.

  2. 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 instance
FlutterFire flutterFire = FlutterFire();

// Sign in with email and password
await flutterFire.signInWithEmailAndPassword(email: 'example@email.com', password: 'password');

// Create a new user with email and password
await flutterFire.createUserWithEmailAndPassword(email: 'newuser@email.com', password: 'newpassword');

// Sign in with Google authentication
await flutterFire.signInWithGoogle();

2. Firestore Operations :

// Get a single document by ID
Map<String, dynamic>? document = await flutterFire.findOne('collectionName', 'documentId');

// Get all documents in a collection
List<dynamic>? documents = await flutterFire.findAll('collectionName');

// Stream data from a Firestore collection
Stream<QuerySnapshot<Map<String, dynamic>>> stream = flutterFire.getStreamData('collectionName');

// Retrieve data from a Firestore collection
Map<String, dynamic> data = flutterFire.getData('collectionName');

// Find documents present in a list of document IDs and return them as a stream
Stream<List<Map<String, dynamic>>> docStream = flutterFire.findStreamContainingList('collectionName', 'documentId', ['id1', 'id2']);

3. Convenience Features:

// Access the current user
User? currentUser = flutterFire.currentUser;

// Stream for authentication state changes
Stream<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.

所屬分類

依賴

依賴清單 5 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。