dio_cache_ttl 0.3.1 copy "dio_cache_ttl: ^0.3.1" to clipboard
dio_cache_ttl: ^0.3.1 copied to clipboard

Caching system for Flutter using dio with TTL.

dio_cache_ttl #

A Flutter package for caching files using Dio with Time-to-Live (TTL) support.

Features #

  • Cache files locally with a specified TTL.
  • Uses Dio for downloading.
  • Automatically clears expired cache.
  • Supports custom cache directories.

Installation #

Add this to your pubspec.yaml:

dependencies:
  dio_cache_ttl:
    git:
      url: https://github.com/cas8938/dio_cache_ttl.git

Or add via CLI:

flutter pub add dio_cache_ttl

Usage #

Import the package #

import 'package:dio_cache_ttl/dio_cache_ttl.dart';

Cache a file #

import 'dart:io';
import 'package:dio_cache_ttl/dio_cache_ttl.dart';

void main() async {
  File file = await dioCache(
    "https://example.com/sample.pdf",
    extFile: "pdf",
    ttl: Duration(hours: 1), // Cache for 1 hour
  );
  print("File saved at: ${file.path}");
}

Testing #

Run tests using:

flutter test

License #

This project is licensed under the MIT License - see the LICENSE file for details.

1
likes
0
points
29
downloads

Publisher

verified publisherflagodna.com

Weekly Downloads

Caching system for Flutter using dio with TTL.

Repository (GitHub)
View/report issues

Topics

#cache #ttl #dio #file

Documentation

Documentation

License

unknown (license)

Dependencies

dio, flutter, path_provider

More

Packages that depend on dio_cache_ttl