Skip to content
pubscout

fquery

3.1.0, released 5 months ago by an unverified publisher

Async state management with automatic caching and refetching for Flutter.

WASM-ready
$ flutter pub add fquery
Source repository

What it does

fquery provides widgets and hooks to fetch, cache, and invalidate asynchronous data. It handles loading, error, and stale states, and supports infinite queries and mutations.

AI-written summary of version 3.1.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • Fetching data from REST/GraphQL APIs
  • Managing local async data like SQLite queries
  • Implementing infinite scroll or paginated lists
  • Using hooks for functional widget trees

Skip it when

  • Replacing complex synchronous state logic that requires custom reducers
  • Projects that need extensive code generation or custom serialization

Strengths

  • Built-in caching and garbage collection
  • Automatic refetching and stale handling
  • Hooks and widget APIs for declarative usage
  • Supports infinite queries and mutations

Weaknesses

  • Relatively new, limited third‑party integrations
  • Documentation still evolving
  • No code generation support

Setup

Kind
Flutter widgets
Effort
Low
Code generation
Yes (build_runner)
Direct dependencies
5

Wrap the root widget with CacheProvider and provide a QueryCache instance.

```dart
class TodoWidget extends StatelessWidget {
  const TodoWidget({super.key});
  @override
  Widget build(BuildContext context) {
    return QueryBuilder<List<Todo>, Exception>(
      options: QueryOptions(
        queryKey: QueryKey(['todos']),
        queryFn: TodosAPI.getInstance().getAll,
      ),
      builder: (context, todos) {
        if (todos.isLoading) return const Center(child: CircularProgressIndicator());
        if (todos.isError) return Center(child: Text(todos.error!.toString()));
        return ListView.builder(
          itemCount: todos.data!.length,
          itemBuilder: (context, index) => ListTile(title: Text(todos.data![index].text)),
        );
      },
    );
  }
}
```

Alternatives

Packages that do the same job and could replace fquery.

  • yx_state

    A state management library for Dart and Flutter applications.

  • riverpod

    A reactive caching and data-binding framework. Riverpod makes working with asynchronous code a breeze.

  • flutter_riverpod

    A reactive caching and data-binding framework for Flutter.

  • hooks_riverpod

    A reactive caching, data-binding, and state management framework with flutter_hooks integration.

Works with

Packages commonly used together with fquery: ones it builds on, ones built on it, and its own family.