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

Server data caching for Flutter: cache API responses, refetch in the background, paginate, mutate with optimistic updates, and keep data across restarts.

example/lib/main.dart

import 'package:example/app/app.dart';
import 'package:example/app/data/feed_mutations.dart';
import 'package:example/app/data/preferences_storage.dart';
import 'package:flutter/material.dart';
import 'package:fuery/fuery.dart';
import 'package:shared_preferences/shared_preferences.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  // Queries and mutations with `persist` are stored here, so the feed is on
  // screen before the first request finishes, and a comment written offline
  // is sent even if the app was closed in between.
  final preferences = await SharedPreferencesWithCache.create(
    cacheOptions: const SharedPreferencesWithCacheOptions(),
  );
  Fuery.client = QueryClient(storage: PreferencesStorage(preferences));
  await Fuery.client.restore(mutations: [addCommentOptions()]);

  runApp(const FeedApp());
}
2
likes
160
points
364
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

Server data caching for Flutter: cache API responses, refetch in the background, paginate, mutate with optimistic updates, and keep data across restarts.

Homepage
Repository (GitHub)
View/report issues

Topics

#state-management #server-state #cache #caching #offline

License

MIT (license)

Dependencies

flutter, fuery_core

More

Packages that depend on fuery