fluquery 1.0.2
fluquery: ^1.0.2 copied to clipboard
Powerful asynchronous state management, server-state utilities and data fetching for Flutter. Inspired by TanStack Query (React Query). Features automatic caching, background refetching, mutations, [...]
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
1.0.1 - 2024-12-25 #
Fixed #
- Polling: Fixed interval changes not taking effect -
refetchIntervalnow properly updates the polling timer when changed - Lowered
flutter_lintsversion to^5.0.0for broader SDK compatibility
Added #
- Nested Queries Example: Complex master-detail pattern demonstrating:
- Per-item queries (each list item fetches its own data)
- Modal with multiple dependent queries
- Optimistic updates on subtasks
- Cache invalidation cascading
- Real-time activity tracking with auto-polling
- New backend endpoints for todo details, subtasks, and activities
Changed #
- Removed Docker files from repository (simplified to Dart-only backend)
- Updated documentation with expanded API endpoints
1.0.0 - 2024-12-25 #
Added #
-
Initial release of FluQuery
-
Core Features:
useQueryhook for data fetching with automatic cachinguseQuerySelecthook for data fetching with transformationuseMutationhook for create/update/delete operationsuseInfiniteQueryhook for paginated/infinite scroll queriesuseQuerieshook for parallel queriesuseQueryClienthook to access the QueryClientuseIsFetchinghook to check fetching stateuseIsMutatinghook to check mutation stateuseSimpleQueryhook for simplified queries
-
Caching & Synchronization:
- Automatic query caching with configurable stale times
- Garbage collection for unused cache entries
- Cache invalidation and refetching
- Manual cache manipulation via
setQueryDataandgetQueryData
-
Background Refetching:
- Refetch on window/tab focus (web and mobile)
- Refetch on network reconnection
- Refetch on widget mount
- Configurable polling intervals
-
Race Condition Handling:
- Automatic cancellation of stale requests
- Query cancellation via
CancellationToken cancelQueriesmethod for manual cancellation
-
Data Transformation:
selectfunction for transforming query datauseQuerySelecthook for select + query in one
-
Smooth Transitions:
keepPreviousDataoption for smooth UI transitionsisPreviousDataproperty to detect stale data display
-
Error Handling:
- Automatic retry with exponential backoff
- Configurable retry count and delay
- Error state management
-
Optimistic Updates:
onMutatecallback for optimistic updatesonErrorcallback for rollbackonSettledcallback for cleanuponSuccesscallback for cache updates
-
Widgets:
QueryClientProviderfor dependency injectionQueryBuilderwidget as an alternative to hooks
-
Utilities:
QueryFocusManagerfor app lifecycle managementConnectivityManagerfor network stateFluQueryLoggerfor debug logging
Example App #
- Basic query example with loading/error states
- Mutation example with CRUD operations
- Infinite query example with pagination
- Dependent queries example
- Polling example with server time
- Optimistic updates example
- Race condition handling example (with 3 demos: Search, Filters, Cancellation)
- Advanced features example (with 3 demos: Select, Keep Previous Data, Comparison)
Backend #
- Simple Dart backend for testing (run with
dart run bin/server.dart) - In-memory database with todos, posts, users, comments
- Configurable artificial delays for race condition demos