smart_query 1.0.0
smart_query: ^1.0.0 copied to clipboard
Async server-state management for Flutter — caching, deduplication, background sync, optimistic updates, and pagination. Inspired by TanStack Query.
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.0 - 2026-03-28 #
Added #
- QueryBuilder — Declarative widget for fetching, caching, and displaying server data with automatic refetching.
- MutationBuilder — Widget for performing create/update/delete operations with optimistic update support.
- InfiniteQueryBuilder — Widget for cursor-based infinite scroll and "Load more" patterns.
- PaginatedQueryBuilder — Widget for classic page-number pagination with
keepPreviousData. - QueryClient — Central API for cache operations:
prefetchQuery,invalidateQueries,setQueryData,cancelQueries,getQueryData. - QueryCache — In-memory cache with deterministic key serialization, hierarchical prefix invalidation, and observer-based eviction.
- Query state machine — Full lifecycle with
idle,loading,success,error,refreshingstates. - Automatic retry — Configurable retry count with exponential backoff and jitter.
- Fetch deduplication — Multiple subscribers share a single in-flight network request.
- Stale-while-revalidate — Show cached data immediately, refetch in background.
- Background sync —
AppLifecycleObserverrefetches stale data on app resume with 500ms debounce. - Connectivity awareness — Abstract
ConnectivityObserverinterface for refetch on reconnect. - Query defaults — Global default options (
staleTime,cacheTime,retry, etc.) viaQueryDefaults. - Example app demonstrating all features with JSONPlaceholder API.