
Fl-Query
Asynchronous data caching, refetching & invalidation library for Flutter. FL-Query lets you manage & distribute your async data without touching any global state Fl-Query makes asynchronous server state management a breeze in flutter # Features - Async data caching & management - Smart + effective refetching - Optimistic updates - Automatically cached data invalidation & unneeded query/mutation garbage collection - Infinite pagination via `InfiniteQuery` - Easy to write & understand code. Follows DRY (Don't repeat yourself) convention - Compatible with both vanilla Flutter & elite [flutter_hooks](https://pub.dev/packages/flutter_hooks) # Installation Regular installation: ```bash $ flutter pub add fl_query ``` For elite flutter_hooks user: ```bash $ flutter pub add flutter_hooks $ flutter pub add fl_query_hooks ``` # Docs You can find the documentation (WIP) of fl-query at https://fl-query.vercel.app/ # Basic Usage Initialize the cache databases in your `main` method > fl-query uses [hive](https://pub.dev/packages/hive) for persisting data to disk ```dart void main()async { WidgetsFlutterBinding.ensureInitialized(); await QueryClient.initialize(cachePrefix: 'fl_query_example'); runApp(MyApp()); } ``` In `MyApp` Widget's build method wrap your `MaterialApp` with with `QueryClientProvider` widget ```dart Widget build(BuildContext context) { return QueryClientProvider( child: MaterialApp( title: 'Fl-Query Example App', theme: ThemeData( useMaterial3: true, primarySwatch: Colors.blue, ), home: const MyHomePage(), ), ); } ``` # Why?