fluquery 1.3.1 copy "fluquery: ^1.3.1" to clipboard
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.3.1 - 2025-12-27 #

Fixed #

  • Fix devtools issue in release builds

1.3.0 - 2025-12-27 #

Fixed #

  • Add devtools to the project
  • Fix issue with store ownership

1.2.0 - 2025-12-26 #

Added(Experimental) #

  • Services: Service layer for managing application state
    • Service base class for creating services
    • ServiceContainer for managing service registration, resolution, and lifecycle
    • ServiceRef for dependency injection
    • ServiceDisposedException for handling service disposal
    • ServiceStatus for managing service status

1.1.1 - 2025-12-26 #

Fixed #

  • Refine query client

1.1.0 - 2025-12-26 #

Added #

  • Persistence: Persist query data to storage and restore on app restart
    • useQuery hook now supports persist option
    • QueryClient now supports persister option
    • HiveCePersister implementation for production use
    • InMemoryPersister implementation for testing
    • PersistOptions for configuring persistence

1.0.6 - 2024-12-26 #

Fixed #

  • Fix issue with multiple query keys for the same query function

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 method
    • client.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.4 - 2024-12-25 #

Fixed #

  • Fix use_infinite_query.dart issue

1.0.3 - 2024-12-25 #

Fixed #

  • Bug fixes

1.0.2 - 2024-12-25 #

Fixed #

  • Reduced use_todo_mutations.dart from 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 - refetchInterval now properly updates the polling timer when changed
  • Lowered flutter_lints version to ^5.0.0 for 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:

    • useQuery hook for data fetching with automatic caching
    • useQuerySelect hook for data fetching with transformation
    • useMutation hook for create/update/delete operations
    • useInfiniteQuery hook for paginated/infinite scroll queries
    • useQueries hook for parallel queries
    • useQueryClient hook to access the QueryClient
    • useIsFetching hook to check fetching state
    • useIsMutating hook to check mutation state
    • useSimpleQuery hook 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 setQueryData and getQueryData
  • 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
    • cancelQueries method for manual cancellation
  • Data Transformation:

    • select function for transforming query data
    • useQuerySelect hook for select + query in one
  • Smooth Transitions:

    • keepPreviousData option for smooth UI transitions
    • isPreviousData property to detect stale data display
  • Error Handling:

    • Automatic retry with exponential backoff
    • Configurable retry count and delay
    • Error state management
  • Optimistic Updates:

    • onMutate callback for optimistic updates
    • onError callback for rollback
    • onSettled callback for cleanup
    • onSuccess callback for cache updates
  • Widgets:

    • QueryClientProvider for dependency injection
    • QueryBuilder widget as an alternative to hooks
  • Utilities:

    • QueryFocusManager for app lifecycle management
    • ConnectivityManager for network state
    • FluQueryLogger for 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
6
likes
150
points
123
downloads

Publisher

unverified uploader

Weekly Downloads

Async state management & data fetching for Flutter. Caching, mutations, infinite queries, optimistic updates.

Repository (GitHub)
View/report issues

Topics

#state-management #caching #api #hooks #query

Documentation

Documentation
API reference

License

MIT (license)

Dependencies

collection, connectivity_plus, flutter, flutter_hooks, hive_ce, hive_ce_flutter, path_provider

More

Packages that depend on fluquery