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

套件詳情v1.0.0

flutter_use

包含36個可用於生產環境的Flutter鈎子,涵蓋非同步操作、表單管理、UI互動和狀態管理。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
5940
喜歡數
84
Pub 分數
150

安裝套件

flutter pub add flutter_use

套件介紹

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

flutter_use 是一個包含 36 個可直接用於生產環境的 Flutter 鈎子的綜合性集合,旨在簡化狀態管理、表單處理、UI 互動和異步操作。由 wasabeef.jp 所開發,該套件為開發者提供可重複使用且可組合的函數,能無縫整合至 Flutter 組件中。此套件支援所有主要平台——Android、iOS、Web、macOS、Windows 與 Linux,非常適合跨平台開發。透過乾淨直覺的 API,flutter_use 減少冗餘程式碼,提升程式碼可讀性,進而實現更快的開發週期與更具維護性的應用程式。

適用情境

  • 管理表單狀態
  • 處理異步資料擷取
  • 簡化狀態邏輯
  • 建立可重複使用的 UI 元件
  • 實作動畫與手勢
  • 建構反應式介面

主要特色

  • 36 個可直接用於生產的鈎子
  • 對異步操作的內建支援
  • 表單管理工具
  • UI 互動輔助工具
  • 跨平台相容性
  • 最小化樣板程式碼

適合對象

  • 尋求高效狀態管理的 Flutter 開發人員
  • 建構複雜 UI 的團隊
  • 需要可重用邏輯的專案
  • 在Flutter中採用函數式程式設計模式的開發者
  • 針對多個平台的應用程式

使用建議

  • 需要熟悉鈎子模式
  • 可能會稍微增加套件大小
  • 最佳搭配函數式組件設計使用
  • 不適合用於簡單的靜態UI
  • 依賴於 Dart 的函數式程式設計概念

原始 README

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

flutter_use

flutter_lints
Inspired by react-use.


A collection of Flutter Hooks inspired by React's react-use library. This monorepo contains multiple packages providing different categories of hooks for Flutter development.

📦 Packages

Package Description Version
flutter_use Core hooks library with essential utilities pub package
flutter_use_audio Audio playback and control hooks pub package
flutter_use_battery Battery state monitoring hooks pub package
flutter_use_geolocation Location and permission hooks pub package
flutter_use_network_state Network connectivity hooks pub package
flutter_use_sensors Device sensors hooks pub package
flutter_use_video Video playbook hooks pub package

🚀 Installation

For the core package:

flutter pub add flutter_use

For specialized packages:

flutter pub add flutter_use_audio    # Audio hooks
flutter pub add flutter_use_battery  # Battery hooks
# ... and so on

🌐 Interactive Demo Site

Try out all hooks with live examples at: https://wasabeef.github.io/flutter_use/

📚 Hooks by Category

📱 Mobile-first Hooks

Core package: flutter_use

  • useAsync — manages async operations with loading, data, and error states.
  • useDebounceFn — debounces function calls for better performance.
  • useInfiniteScroll — implements infinite scrolling with automatic loading.
  • useForm — comprehensive form state management with validation.
  • useKeyboard — tracks keyboard visibility and manages layouts (mobile only).
🎭 State Management

Core package: flutter_use

⏱️ Timing & Animation

Core package: flutter_use

🔄 Side Effects & Performance

Core package: flutter_use

🎯 UI Interactions

Core package: flutter_use

♻️ Lifecycle Management

Core package: flutter_use

🎨 Development & Debugging

Core package: flutter_use

  • useLogger — logs in console as component goes through life-cycles.
📱 Device Sensors

Package: flutter_use_sensors

Core package: flutter_use

🔋 Device Information

Package: flutter_use_battery

Package: flutter_use_geolocation

  • useGeolocation — tracks geo location and permission state of user's device. geolocator

Package: flutter_use_network_state

🎵 Media

Package: flutter_use_audio

  • useAudio — plays audio and exposes its controls. just_audio

Package: flutter_use_video

🚧 Coming Soon

  • useEvent — subscribe to events.
  • useFullscreen — display an element or video full-screen.
  • usePageLeave — triggers when mouse leaves page boundaries.
  • usePermission — query permission status for apps APIs.
  • useMethods — neat alternative to useReducer.
  • useSetState — creates setState method which works like this.setState.
  • usePromise — resolves promise only while component is mounted.
  • useObservable — tracks latest value of an Observable.



Unlicense — public domain.



所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案