Skip to content
pubscout

dio_cache_plus

2.1.0, released 3 weeks ago by balu.dev

Advanced Dio interceptor that adds flexible caching, expiry and deduplication.

$ flutter pub add dio_cache_plus
Source repository

What it does

Provides per‑request control over caching, conditional rules, absolute or relative expiry, and request deduplication for Dio HTTP calls. Stores cached responses persistently using Hive and adds standard Cache‑Status headers.

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

Use it when

  • You need fine‑grained caching for Dio requests
  • You want automatic cache expiry and deduplication

Skip it when

  • You are not using Dio as your HTTP client
  • You need a lightweight solution without persistent storage

Strengths

  • Highly configurable per‑request caching
  • Supports both duration and absolute expiry
  • Persistent cross‑platform storage with Hive
  • Request deduplication reduces network load

Weaknesses

  • Adds complexity compared to plain Dio
  • Relies on Hive which may increase app size
  • Only works with Dio, not other HTTP clients

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
4
import 'package:dio/dio.dart';
import 'package:dio_cache_plus/dio_cache_plus.dart';

final dio = Dio();
 dio.interceptors.add(DioCachePlusInterceptor(cacheAll:false,commonCacheDuration:const Duration(minutes:5)));
final response = await dio.get('/api/data',options: Options().setCaching(enableCache:true));

Alternatives

Packages that do the same job and could replace dio_cache_plus.

  • http

    Lightweight HTTP client without caching overhead

Works with

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