API Cache Plugin

A Flutter plugin for caching API responses using Hive storage with GZip compression.
Configurable cache timeout (default: 3 minutes).

Features

  • Hive persistent storage.
  • GZip compression for efficient storage.
  • Configurable cache timeout.
  • Works with any HTTP library (http, Dio, Chopper, etc.).

Usage

final cache = CacheManager();
const url = "https://api.example.com/data";

final cached = await cache.getCached(url);
if (cached != null) {
  print("From Cache: $cached");
} else {
  final response = await http.get(Uri.parse(url));
  await cache.saveCache(url, response.body);
}

Libraries

api_cache_plugin