dartquery 1.0.0
dartquery: ^1.0.0 copied to clipboard
A reactive in-memory data management library for Dart and Flutter with intelligent caching, similar to React Query.
Changelog #
1.0.0 - 2024-01-29 #
Initial Release #
🎉 First stable release of DartQuery!
Features
- Reactive Data Management - Automatic UI updates when data changes
- Smart Caching - Intelligent caching with configurable stale and cache times
- Cache Size Management - Configurable limits with intelligent eviction policies
- Multiple eviction strategies: LRU, LRC, LFU, TTL
- Memory-based and count-based limits
- Automatic cleanup and memory pressure handling
- Request Deduplication - Prevents duplicate API calls for the same data
- In-Memory Storage - Fast key-value storage accessible across your app
- Query Invalidation - Manual cache invalidation and cleanup
- Flutter Integration - Purpose-built widgets for reactive UI
- QueryBuilder for data fetching and UI rendering
- QueryConsumer for lightweight data consumption
- QueryProvider for dependency injection
- Type Safety - Full type safety in Dart
- Performance Optimized - Atomic operations and efficient state management
- Memory Leak Prevention - Automatic cleanup of disposed queries
- Comprehensive Testing - Extensive test coverage for all components
Cache Management Features
- Configurable cache size limits (query count and memory usage)
- Four eviction policies: LRU, LRC, LFU, TTL
- Automatic memory pressure handling for mobile platforms
- Real-time cache statistics and monitoring
- Pre-configured settings for different app sizes (compact, default, large, unlimited)
Developer Experience
- Simple and intuitive API
- Comprehensive documentation and examples
- TypeScript-like developer experience in Dart
- Easy migration from React Query concepts
Example Usage
// Simple key-value storage
DartQuery.instance.put('user-id', 'john_123');
// Async data fetching with caching
final userData = await DartQuery.instance.fetch(
'user-profile',
() async => await apiClient.getUserProfile(),
staleTime: Duration(minutes: 5),
);
// Reactive UI with QueryBuilder
QueryBuilder<User>(
queryKey: 'user-profile',
fetcher: () => userService.getProfile(),
builder: (context, query) {
if (query.isLoading) return CircularProgressIndicator();
if (query.isError) return Text('Error: ${query.error}');
return Text('Hello, ${query.data?.name}!');
},
);
Platform Support
- Flutter (iOS, Android, Web, Desktop)
- Dart (VM, Web)
- Minimum Dart SDK: 3.0.0
- Minimum Flutter: 3.0.0