cached_query_flutter
3.4.1, released 3 weeks ago by cachedquery.dev
Widgets and addons for Cached Query in Flutter including query and mutation builders.
What it does
Provides Flutter-specific builders and configuration extensions for Cached Query. It allows refetching queries automatically on app resume or when connection is re-established, and supplies QueryBuilder, InfiniteQueryBuilder, and MutationBuilder widgets.
AI-written summary of version 3.4.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You are already using Cached Query for server state management in Dart.
- You need UI builders like QueryBuilder or MutationBuilder for your queries.
- You want automatic query refetching on app resume and connectivity changes.
Skip it when
- You are not using Cached Query.
- You want a general-purpose state management solution like Bloc or Riverpod without caching server data.
Strengths
- Seamlessly integrates Cached Query with Flutter widgets.
- Automatic refetching on resume and network change via connectivity_plus.
- Works well alongside other state management patterns like the bloc pattern.
Weaknesses
- Tight coupling to the Cached Query ecosystem.
- Requires additional configuration compared to standalone state managers.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 2
Configure CachedQuery with configFlutter instead of config, and optionally initialize CachedStorage.
CachedQuery.instance.configFlutter(
config: GlobalQueryConfigFlutter(
refetchOnConnection: true,
refetchOnResume: true,
),
storage: await CachedStorage.ensureInitialized(),
);Alternatives
Packages that do the same job and could replace cached_query_flutter.
- flutter_bloc
If you prefer a full-fledged event-driven state management architecture rather than dedicated query caching.
86Compare - riverpod
If you want compile-safe global state management with built-in family and caching capabilities.
99Compare - provider
If you need a simpler dependency injection and state propagation tool.
81Compare
Works with
Packages commonly used together with cached_query_flutter: ones it builds on, ones built on it, and its own family.
- connectivity_pluscached_query_flutter depends on itDiscover the state of network connectivity (WiFi, mobile, ethernet) on Android, iOS, Web and desktops.
- cached_querycached_query_flutter depends on itLibrary for caching, background fetching, and managing server state in Dart and Flutter.
- cached_storageSame familyAdds persistent storage to CachedQuery using Sqflite