flutter_query_client 1.1.0 copy "flutter_query_client: ^1.1.0" to clipboard
flutter_query_client: ^1.1.0 copied to clipboard

A TanStack Query-inspired server state management library for Flutter. Handles caching, background refetching, pagination, mutations, and network-aware fetching out of the box.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_query_client/flutter_query_client.dart';
import 'home_screen.dart';

void main() {
  runApp(const App());
}

class App extends StatelessWidget {
  const App({super.key});

  @override
  Widget build(BuildContext context) {
    return QueryClientProvider(
      client: QueryClient.instance,
      defaults: QueryDefaults(
        staleTime: Duration(minutes: 5),
        gcTime: Duration(minutes: 10),
        retryCount: 3,
        enableLogging: true,
        connectivityEndpoints: [
          InternetCheckOption(
            uri: Uri.parse('https://jsonplaceholder.typicode.com/todos/1'),
          ),
        ],
        transformError: (error) {
          if (error is QueryException) {
            return Exception(
              'Query failed with status code ${error.toString()}: ${error.message}',
            );
          }
          return error;
        },
      ),
      child: MaterialApp(
        title: 'Query Client',
        debugShowCheckedModeBanner: false,
        theme: ThemeData(
          colorSchemeSeed: Colors.indigo,
          useMaterial3: true,
        ),
        darkTheme: ThemeData(
          colorSchemeSeed: Colors.indigo,
          brightness: Brightness.dark,
          useMaterial3: true,
        ),
        themeMode: ThemeMode.dark,
        home: const HomeScreen(),
      ),
    );
  }
}
2
likes
0
points
228
downloads

Publisher

unverified uploader

Weekly Downloads

A TanStack Query-inspired server state management library for Flutter. Handles caching, background refetching, pagination, mutations, and network-aware fetching out of the box.

Repository (GitHub)
View/report issues

Topics

#state-management #caching #fquery #flutter-query #tanstack-query

License

unknown (license)

Dependencies

bloc, connectivity_plus, flutter, flutter_bloc, freezed_annotation, internet_connection_checker_plus, logging, meta

More

Packages that depend on flutter_query_client