dio_cookie_manager
3.5.0, released 4 months ago by flutter.cn
A cookie manager for Dio combining cookie_jar and Dio based on the interceptor algorithm.
Rock solid
What it does
It automatically manages and persists cookies for network requests made using the Dio HTTP client. It acts as an interceptor to load stored cookies into requests and save new cookies from responses.
AI-written summary of version 3.5.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You are using Dio for networking and need automatic cookie management
- You need to persist cookies across app restarts using file storage
Skip it when
- You are not using the Dio HTTP client
- Your API is entirely stateless and does not use cookies
Strengths
- Seamless integration with Dio via interceptors
- Supports persistent cookie storage using cookie_jar
- Handles redirect requests and invalid cookies with specific options
Weaknesses
- Tied strictly to Dio and cookie_jar packages
- Upgrading major versions of cookie_jar can lead to losing previously stored cookies
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 2
Requires adding the package and attaching a CookieManager interceptor to your Dio instance.
import 'package:cookie_jar/cookie_jar.dart';
import 'package:dio/dio.dart';
import 'package:dio_cookie_manager/dio_cookie_manager.dart';
void main() async {
final dio = Dio();
final cookieJar = CookieJar();
dio.interceptors.add(CookieManager(cookieJar));
await dio.get("https://dart.dev");
}Alternatives
Packages that do the same job and could replace dio_cookie_manager.
Works with
Packages commonly used together with dio_cookie_manager: ones it builds on, ones built on it, and its own family.
- diodio_cookie_manager depends on itA powerful HTTP networking package for Dart and Flutter with interceptors and request cancellation.
- cookie_jardio_cookie_manager depends on itA Dart cookie manager for HTTP requests with in‑memory and persistent storage.
- dio_web_adapterSame familyWeb and WASM HTTP client adapter for Dio.
- native_dio_adapterSame familyA Dio HTTP client adapter that uses native platform HTTP stacks via cupertino_http and cronet_http.
- dio_http2_adapterSame familyHTTP/2 adapter for Dio with connection reuse and header compression
- flutter_better_authBuilt on dio_cookie_managerDart and Flutter client for the Better Auth platform.
- better_auth_flutterBuilt on dio_cookie_managerFlutter SDK for Better Auth providing email/password, social sign‑in, session management and reactive auth state.