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_ltsWhat 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.
- dio_cache_interceptor
Dio HTTP cache interceptor with multiple stores respecting HTTP directives.
87Compare - http2
An HTTP/2 implementation in Dart for low-level transport and pooled HTTP/2 requests.
91Compare - dio_web_adapter
Web and WASM HTTP client adapter for Dio.
83Compare - talker_dio_logger
A lightweight, customizable logger for Dio HTTP client built on Talker.
92Compare
Works with
Packages commonly used together with dio_http_cache_lts: ones it builds on, ones built on it, and its own family.
- cryptodio_http_cache_lts depends on itProvides SHA, MD5, and HMAC hashing functions for Dart.
- json_annotationdio_http_cache_lts depends on itProvides annotations for json_serializable to generate JSON (de)serialization code.
- diodio_http_cache_lts depends on itA powerful HTTP networking package for Dart and Flutter with interceptors and request cancellation.
- json_serializabledio_http_cache_lts depends on itAutomatically generate code for converting Dart classes to and from JSON.
- quiverdio_http_cache_lts depends on itA set of utility libraries for Dart containing collections, async tools, and testing helpers.
- sqflitedio_http_cache_lts depends on itSQLite plugin for Flutter supporting iOS, Android and MacOS.