Skip to content
pubscout

dio_http_cache_lts

0.4.2, released 2 years ago by joydash.com

HTTP cache manager for the Dio package using SQLite

$ flutter pub add dio_http_cache_lts

What it does

Provides caching capabilities for Dio HTTP requests, storing responses in memory and a local SQLite database. Allows configuring cache duration, stale times, custom keys, and manual cache deletion.

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

Use it when

  • You are using the Dio HTTP client and need to cache API responses locally.
  • You need offline fallback support using stale cache data when network requests fail.

Skip it when

  • You are not using the Dio networking library.
  • You need a general-purpose key-value storage solution rather than HTTP caching.

Strengths

  • Easy integration as a Dio interceptor.
  • Supports custom maxAge and maxStale durations.
  • Provides automated or manual cache cleaning and deletion methods.

Weaknesses

  • Maintenance version of an older package (dio-http-cache).
  • Tied specifically to the Dio ecosystem.

Setup

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

Add the interceptor to your Dio instance with a CacheConfig.

dio.interceptors.add(DioCacheManager(CacheConfig(baseUrl: "http://www.google.com")).interceptor);

Dio().get(
  "http://www.google.com",
  options: buildCacheOptions(Duration(days: 7)),
);

Alternatives

Packages that do the same job and could replace dio_http_cache_lts.

Works with

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