
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
- 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
First wrap your `MaterialApp` with with `QueryBowlScope` widget
```dart
Widget build(BuildContext context) {
return QueryBowlScope(
child: MaterialApp(
title: 'Fl-Query Example App',
theme: ThemeData(
useMaterial3: true,
primarySwatch: Colors.blue,
),
home: const MyHomePage(),
),
);
}
```
Fl-Query has two types of jobs
- `QueryJob`: Used for storing GET requests or for storing changeable yet readonly async data
- `MutationJob`: Used for POST/PUT/DELETE requests or for mutating/changing data in services or a store asynchronously
You can write all your query or mutation logic a method parameter named `task` & identify the query uniquely by passing a unique `queryKey`
Example of a QueryJob:
```dart
final exampleQueryJob = QueryJob