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

套件詳情v0.3.1+5

firebase_admin

Firebase Admin SDK 的純 Dart 語言程式碼移植版本,符合 Dart 語言習慣

AndroidiOSmacOSWindowsLinux
近 30 天下載
1200
喜歡數
98
Pub 分數
150

安裝套件

flutter pub add firebase_admin

套件介紹

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

firebase_admin 套件提供了一個純粹且符合 Dart 語言習慣的 Firebase Admin SDK 實作,讓伺服器端可以與 Firebase 服務進行互動。它允許開發者認證使用者、管理 Firebase 專案,並從基於 Dart 的後端執行使用者管理、權杖驗證以及資料庫操作等管理任務。此套件專為非瀏覽器環境(如伺服器、CLI 工具或桌面應用程式)設計,支援所有主要平台,包括 Android、iOS、macOS、Windows 和 Linux。該套件非常適合將 Firebase 功能整合至自訂後端系統中,而不需依賴 JavaScript 或外部相依性。

適用情境

  • 伺服器端 Firebase 管理
  • 透過 Firebase Auth 進行使用者管理
  • 令牌驗證和驗證
  • 與 Firebase Firestore 的後端整合
  • 自動 Firebase 項目設定

主要特色

  • 純 Dart 實現
  • 跨平台支援
  • 慣用的 Dart API
  • 安全訪問 Firebase Admin
  • 支援所有 Firebase 服務

適合對象

  • 使用 Dart 的後端開發人員
  • 使用 Firebase 的無伺服器函數
  • 需要 Firebase 存取權限的桌面應用程式
  • 自定義驗證系統
  • 需要 Firebase 自動化的 CI/CD 流水線

使用建議

  • 需要服務帳戶憑證
  • 不適用於客戶端應用程式
  • 需要對私鑰進行安全處理
  • 僅限管理員操作
  • 可能需要特定於平台的設定

原始 README

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

Ceasefire Now

A pure Dart implementation of the Firebase admin sdk

Currently, only supports admin methods for the following firebase services:

  • authentication
  • realtime database

Example using service account

import 'package:firebase_admin/firebase_admin.dart';

main() async {
  var app = FirebaseAdmin.instance.initializeApp(AppOptions(
    credential: ServiceAccountCredential('service-account.json'),
  ));

  var link = await app.auth().generateSignInWithEmailLink('jane@doe.com',
      ActionCodeSettings(url: 'https://example.com'));

  print(link);
}

Example using default credentials

import 'package:firebase_admin/firebase_admin.dart';
import 'package:firebase_admin/src/credential.dart';

void main() async {
  // applicationDefault() will look for credentials in the following locations:
  // * the env variable GOOGLE_APPLICATION_CREDENTIALS
  // * a configuration file, specific for this library, stored in the user's home directory
  // * gcloud's application default credentials
  // * credentials from the firebase tools
  var credential = Credentials.applicationDefault();

  // when no credentials found, login using openid
  // the credentials are stored on disk for later use
  credential ??= await Credentials.login();

  // create an app
  var app = FirebaseAdmin.instance.initializeApp(AppOptions(
      credential: credential ?? Credentials.applicationDefault(),
      projectId: 'some-project'));

  try {
    // get a user by email
    var v = await app.auth().getUserByEmail('jane@doe.com');
    print(v.toJson());
  } on FirebaseException catch (e) {
    print(e.message);
  }
}

Features and bugs

Please file feature requests and bugs at the issue tracker.

Sponsor

Creating and maintaining this package takes a lot of time. If you like the result, please consider to :heart: sponsor. With your support, I will be able to further improve and support this project. Also, check out my other dart packages at pub.dev.

所屬分類

依賴

依賴清單 16 項

原始碼儲存庫

使用此套件的專案