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

套件詳情v0.11.1

flutter_query

使用自動狀態管理和背景更新從伺服器取得、快取並同步資料,靈感來自 TanStack Query。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
383
喜歡數
39
Pub 分數
160

安裝套件

flutter pub add flutter_query

套件介紹

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

Flutter Query 是一個狀態管理套件,用於取得、快取與同步伺服器資料,並自動處理載入、錯誤與成功狀態。受到 TanStack Query 啟發,它透過提供宣告式 API、背景更新與內建快取無效化功能,簡化了 Flutter 應用中的資料取得。此套件支援所有主要平台,並能順暢整合至 Flutter 的反應式生態系中。透過智慧快取策略與自動重新取得,該套件減少重複程式碼並提升效能。

適用情境

  • 即時資料同步
  • 離線優先的應用開發
  • API 數據快取
  • 使用伺服器資料的動態 UI
  • 自動後台刷新

主要特色

  • 自動狀態管理
  • 內建快取和過期後仍可驗證
  • 背景資料同步
  • 宣告式 API 設計
  • 錯誤邊界整合
  • 在視窗取得焦點時重新取得資料

適合對象

  • 開發資料密集型 Flutter 應用的開發者
  • 尋求減少樣板程式碼的團隊
  • 需要離線支援的應用程式
  • 使用 REST 或 GraphQL API 的專案
  • 需要即時資料更新的應用程式

使用建議

  • 新用戶的學習曲線
  • 大型快取可能導致的記憶體使用
  • 需要理解響應式程式設計
  • 在某些邊緣情況下自訂功能有限
  • 可能需要為複雜的認證流程進行額外設定

原始 README

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

flutter_query logo

Flutter Query

CI Status MIT License GitHub Stars

Pub Version Pub Points Pub Likes

A Flutter package inspired by TanStack Query for powerful asynchronous state management. Built with Flutter Hooks.

Coming from TanStack Query? Check out the differences to get started quickly.

Why Flutter Query?

Working with server data is hard. You need caching, deduplication, background refetching, stale data handling, and more. Flutter Query handles all of this out of the box:

  • Automatic caching with intelligent invalidation
  • Request deduplication so multiple widgets share a single network request
  • Background updates to keep data fresh
  • Stale-while-revalidate patterns for instant UI with fresh data
  • Optimistic updates for responsive mutations
  • Retry logic with exponential backoff

Documentation

Visit flutterquery.com for the full documentation, tutorials, and guides.

Platform Support

Android iOS macOS Web Linux Windows
✅ ✅ ✅ ✅ ✅ ✅

Requirements

  • Flutter >=3.32.0
  • Dart >=3.0.0 <4.0.0

Versioning

This project strictly follows Semantic Versioning. Given a version number MAJOR.MINOR.PATCH:

  • MAJOR version increments indicate breaking changes
  • MINOR version increments add functionality in a backward-compatible manner
  • PATCH version increments include backward-compatible bug fixes

Before version 1.0.0, MINOR version increments may include breaking changes.

Support

If you find Flutter Query useful, consider giving it a ⭐ to help others discover it!

所屬分類

依賴

依賴清單 4 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。