dio_cache_interceptor_file_store 1.2.3 copy "dio_cache_interceptor_file_store: ^1.2.3" to clipboard
dio_cache_interceptor_file_store: ^1.2.3 copied to clipboard

A filesystem cache store implementation for dio_cache_interceptor package.

example/lib/main.dart

import 'package:dio/dio.dart';
import 'package:dio_cache_interceptor/dio_cache_interceptor.dart';
import 'package:dio_cache_interceptor_file_store/dio_cache_interceptor_file_store.dart';
import 'package:path_provider/path_provider.dart';

void main(List<String> arguments) {
  // Full example is available at
  // https://github.com/llfbandit/dio_cache_interceptor/blob/master/dio_cache_interceptor/example/lib/main.dart

  late CacheStore cacheStore;

  getTemporaryDirectory().then((dir) {
    cacheStore = FileCacheStore(dir.path);

    var cacheOptions = CacheOptions(
      store: cacheStore,
      hitCacheOnErrorExcept: [], // for offline behaviour
    );

    final dio = Dio()
      ..interceptors.add(
        DioCacheInterceptor(options: cacheOptions),
      );

    dio.get('https://www.foo.com');
  });
}
5
likes
160
points
17.6k
downloads

Publisher

verified publisheropenapi4j.org

Weekly Downloads

A filesystem cache store implementation for dio_cache_interceptor package.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

dio_cache_interceptor, path, synchronized

More

Packages that depend on dio_cache_interceptor_file_store