talira

dio_cache_interceptor

HTTP cache interceptor for Dart's dio client, with pluggable stores

open sourceApache-2.0free

dio_cache_interceptor caches responses for the dio HTTP client in Dart and Flutter. It follows HTTP caching directives (ETag, Last-Modified, Cache-Control, Expires) or a policy you set, and stores responses in memory or, through companion packages, in files, Drift, Hive, Isar, ObjectBox, Sembast or MMKV. The same cache is available for the http package as http_cache_client.

Problems it solves

  • cache API responses in my Flutter app that uses dio
  • make my Dart HTTP client respect ETag and Cache-Control
  • keep HTTP responses on disk so my app works offline

Features

  • respects ETag, Last-Modified, Cache-Control and Expires
  • cache policies that can ignore HTTP directives
  • in-memory LRU store and file, Drift, Hive, Isar, ObjectBox, Sembast and MMKV stores
  • the same cache for the http package

Alternatives

The same job

These do what dio_cache_interceptor does.

  1. dio HTTP client for Dart and Flutter with interceptors, FormData and cancellation
  2. http2 (Dart) HTTP/2 implementation for Dart, with a pooled, multiplexing http.Client
  3. retrofit.dart Type-safe HTTP client generator for Dart, built for dio

Compare dio_cache_interceptor with the top 3