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

套件詳情v5.4.4

google_api_headers

一個用於取得呼叫 Google API 所需標頭的 Flutter 外掛程式,適用於使用應用程式限制 API 金鑰的情況

Android
近 30 天下載
7.2萬
喜歡數
31
Pub 分數
160

安裝套件

flutter pub add google_api_headers

套件介紹

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

一個 Flutter 插件,可簡化使用應用限制的 API 金鑰時,取得存取 Google API 所需 HTTP 標頭的過程。它透過自動產生 'X-Goog-Api-Key' 和 'X-Goog-AuthUser' 等必要標頭,確保安全且符合規範的存取。專為 Android 設計,協助開發者避免整合 Google 後端服務時常見的認證陷阱。

適用情境

  • 與 Google 地圖 API 集成
  • 呼叫 Google Cloud 服務
  • 使用應用限制金鑰保護 API 請求
  • 實現無伺服器 Google API 呼叫
  • 在生產環境中強制執行 API 金鑰限制

主要特色

  • 自動生成所需的標題
  • 支援應用程式限制的 API 金鑰
  • 僅限 Android 平台的相容性
  • 簡化驗證設定
  • 最小化樣板程式碼

適合對象

  • 面向 Android 的 Flutter 應用
  • 使用應用程式限制的 Google API 金鑰的開發人員
  • 需要安全 Google API 存取權限的專案
  • 團隊避免手動管理標題
  • 在受限 API 金鑰環境中的應用部署

使用建議

  • 僅限Android平台
  • 需要正確配置 API 金鑰
  • 不處理 OAuth2 或使用者驗證
  • 不支援 iOS 或 Web 平台
  • 取決於專案中正確設定 Google API 金鑰

原始 README

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

Google API Headers

pub package docs MIT License GitHub Actions codecov Codacy Badge style: flutter_lints

Github-sponsors BuyMeACoffee Ko-Fi LiberaPay Patreon PayPal

A Flutter plugin for getting the headers required to call Google APIs with an app restricted API key.

Getting Started

Add this to your project's pubspec.yaml file:

dependencies:
  google_api_headers: ^5.4.1

Usage

Depending on the platform (iOS or Android), the function will return the required key and value pairs for calling Google APIs with keys that are restricted to an iOS or Android app.

import 'package:google_api_headers/google_api_headers.dart';

final headers = await GoogleApiHeaders().getHeaders();

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案