The caching-first async state management library for Flutter.
Fasq handles async state management, server-state caching, and synchronization for Flutter applications. It is designed to be:
- 🚀 Performant: Intelligent caching, background refetching, and request deduplication.
- 🛠️ Flexible: Works with any state management (Bloc, Riverpod, Hooks, or standalone).
- 🔒 Secure: Built-in encryption support for sensitive data.
- 📱 Production Ready: Robust error recovery, offline support, and 100% type safety.
Inspired by TanStack Query and SWR.
This monorepo manages the following packages:
| Package | Version | Description |
|---|---|---|
| fasq | The core caching, query, and mutation engine. | |
| fasq_bloc | Integration with flutter_bloc. |
|
| fasq_hooks | React-style hooks (useQuery, useMutation). |
|
| fasq_riverpod | Providers for flutter_riverpod. |
|
| fasq_security | Encryption and secure storage plugin. | |
| fasq_serializer_generator | Codegen for typed query keys. |
Detailed documentation is available at fasq.shafi.dev.
Add fasq to your pubspec.yaml (or your preferred adapter):
dependencies:
fasq: ^0.3.7
# Optional adapters:
# fasq_bloc: ...
# fasq_riverpod: ...
# fasq_hooks: ...Available anywhere in your app via QueryClientProvider or specific adapter providers.
void main() {
runApp(
QueryClientProvider(
client: QueryClient(),
child: MyApp(),
),
);
}QueryBuilder<List<Todo>>(
queryKey: 'todos',
queryFn: () => api.fetchTodos(),
builder: (context, state) {
if (state.isLoading) return CircularProgressIndicator();
if (state.hasError) return Text('Error: ${state.error}');
return ListView.builder(
itemCount: state.data!.length,
itemBuilder: (context, index) => Text(state.data![index].title),
);
},
)We welcome contributions! Please see the CONTRIBUTING.md file for details on how to get started.
This project relies on Melos to manage the monorepo.
- Clone the repo:
git clone https://github.com/ishafiul/fasq.git && cd fasq
- Install Melos:
dart pub global activate melos
- Bootstrap:
melos bootstrap
Run unit and widget tests across all packages:
melos run test:allFasq is released under the MIT License. See LICENSE for details.
- TanStack Query (React Query): The primary inspiration for the architecture and API design.
- SWR: For the "stale-while-revalidate" philosophy.
Built with ❤️ by Shafiul Islam.