fluquery 1.3.1
fluquery: ^1.3.1 copied to clipboard
Async state management & data fetching for Flutter. Caching, mutations, infinite queries, optimistic updates.
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.2.0 - 2025-12-26 #
Added(Experimental) #
- Services: Service layer for managing application state
Servicebase class for creating servicesServiceContainerfor managing service registration, resolution, and lifecycleServiceReffor dependency injectionServiceDisposedExceptionfor handling service disposalServiceStatusfor managing service status
1.1.0 - 2025-12-26 #
Added #
- Persistence: Persist query data to storage and restore on app restart
useQueryhook now supportspersistoptionQueryClientnow supportspersisteroptionHiveCePersisterimplementation for production useInMemoryPersisterimplementation for testingPersistOptionsfor configuring persistence
1.0.5 - 2024-12-25 #
Added #
- QueryStore: Persistent query stores that exist independently of widget lifecycle
- Background polling without widgets
- Never garbage collected (until disposed)
- Stream-based subscriptions
- Direct data manipulation (
setData,updateData) client.createStore()factory methodclient.getStore(),client.removeStore()management
- Query.subscribe(): Subscribe to query state changes without widget lifecycle
- client.subscribeToQuery(): Lightweight subscription to any query
Example #
// Create a persistent store
final userStore = client.createStore<User, Object>(
queryKey: ['user'],
queryFn: fetchUser,
refetchInterval: Duration(minutes: 5),
);
// Access anywhere
userStore.data;
userStore.subscribe((state) => print(state));
userStore.refetch();
userStore.dispose();
1.0.2 - 2024-12-25 #
Fixed #
- Reduced
use_todo_mutations.dartfrom 320 lines to 175 lines by removing unnecessary optimistic update complexity
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