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

套件詳情v2.9.1

postgrest

Dart 的 PostgREST 客戶端。此程式庫為 PostgREST 提供了 ORM 接口。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
126萬
喜歡數
137
Pub 分數
150

安裝套件

flutter pub add postgrest

套件介紹

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

PostgREST 是一個 Dart 客戶端程式庫,提供類似 ORM 的介面,用於與 PostgREST(一個 PostgreSQL 資料庫的 RESTful API 伺服器)互動。它讓開發者能夠使用 HTTP 請求執行資料庫操作,並將 SQL 查詢抽象為直覺的方法呼叫。專為 Supabase 設計,簡化了跨多個平台的資料檢索、插入、更新和刪除。該程式庫支援所有主要平台,包括 Android、iOS、Web、macOS、Windows 和 Linux,非常適合全端 Dart 應用程式。

適用情境

  • 使用 Supabase 建構即時應用
  • 對PostgreSQL執行CRUD操作
  • 無需自定義 API 即可整合後端邏輯
  • 創建跨平台的資料庫驅動應用程式
  • 簡化 Flutter 中的資料庫互動
  • 啟用安全、可擴展的資料存取

主要特色

  • PostgREST 的 ORM 風格介面
  • 支援所有主要平台
  • 與 Supabase 的無縫整合
  • 類型安全的查詢構建
  • 自動 JSON 序列化
  • 靈活的篩選和排序

適合對象

  • 使用 Supabase 的 Flutter 開發人員
  • 需要直接訪問 PostgreSQL 的應用
  • 避免自定義後端服務的團隊
  • 需要快速原型設計的項目
  • 尋求輕量級資料庫客戶端的開發者

使用建議

  • 需要一個正在運行的 PostgREST 伺服器
  • 依賴於 Supabase 生態系統
  • 僅限基於 PostgreSQL 的 API
  • 身份驗證必須由外部處理
  • 不適用於需要自訂的複雜SQL情境

原始 README

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


Supabase Logo

Supabase Flutter

Flutter client library for Supabase.

Guides · Reference Docs · Migration Guides

Build Package License: MIT

Run locally

This repo is a monorepo powered by Melos containing supabase_flutter and its sub-libraries. All packages are located in the packages directory.

To install on a locally developed app:

  • Clone this repo
  • Install Melos globally if you haven't already: dart pub global activate melos
  • Run melos bootstrap or melos bs at the root of the cloned directory to install dependencies
  • Add the target package to your pubspec.yaml file specifying the path.
    supabase_flutter:
      path: <your-path-to-the-local-supabase-flutter-repo>/packages/supabase_flutter
    

Testing your app

The helpers the test suites of these packages run on are published in package:supabase_test, so your tests can build on the same primitives: mock HTTP clients, JWT builders, auth session fixtures and realtime frames. Add the package as a dev dependency:

dev_dependencies:
  supabase_test: ^0.1.0

Then stub the endpoints the code under test talks to and run it against a real SupabaseClient, with no running stack required:

final httpClient = MockSupabaseHttpClient()
  ..stubTable('todos', rows: [
    {'id': 1, 'task': 'Ship it', 'status': false},
  ]);
final supabase = testSupabaseClient(httpClient: httpClient);
addTearDown(supabase.dispose);

final todos = await supabase.from('todos').select();
expect(todos, hasLength(1));

See the supabase_test README for the full guide: stubbing database, rpc, edge function and auth endpoints, asserting on recorded requests, running tests as a signed-in user, and wiring Supabase.initialize in Flutter widget tests.

Testing this repo

The tests for the packages postgrest, supabase_auth, supabase_realtime and supabase_storage run against a local Supabase stack. To run these tests locally you need docker and the Supabase CLI installed.

The single configuration for the stack lives in the supabase directory at the repository root. Start it with:

supabase start

Run the Dart tests within the package directory in packages/<package> with the following command. The -j 1 flag runs the tests not concurrently, which works better since the tests run against the same services.

dart test -j 1

To stop the stack run the following command from the repository root:

supabase stop

Contributing

  • Fork the repo on GitHub
  • Clone the project to your own machine
  • Commit changes to your own branch
  • Push your work back up to your fork
  • Submit a Pull request so that we can review your changes and merge

License

This repo is licensed under MIT.

Resources

所屬分類

依賴

依賴清單 5 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。