file_cache 0.1.8 copy "file_cache: ^0.1.8" to clipboard
file_cache: ^0.1.8 copied to clipboard

outdated

Cache Http request in file system. Provide json/bytes and Image interface.

file_cache #

Cache Http request in file system. Provide json/bytes and Image interface.

Optional cache in memory.

Statistics of read/write item and hit/miss ratio.

How to use #

To use this plugin, add infinite_pagination as a dependency in your pubspec.yaml file. For example:

dependencies:
  file_cache:

API #

import 'package:file_cache/file_cache.dart';

/// Create the instance of FileCache, the cached files stored in `${tmp}/cache2` of [fromDefault] 
FileCache fileCache = await FileCache.fromDefault();

/// Usage: get parsed Json Map
Map data = await fileCache.getJson('http://httpbin.org/cache/600');

// Usage: get bytes
Uint8List bytes = await fileCache.getBytes('http://httpbin.org/images/jpeg');

/// Usage: Replace [NetworkImage] with file cache ability.
Image(
    image: new FileCacheImage('http://httpbin.org/images/jpeg'),
    fit: BoxFit.cover,
);

/// Usage: clean file cache
await fileCache.clean();

/// Usage: access statistics
print(fileCache.stats.toString());
// outputs like:
// "Bytes(Memory): $bytesInMemory\n"
// "Miss(Memory): $missInMemory\n"
// "Hit(Memory): $hitMemory\n"
// "Hit(Files): $hitFiles\n"
// "Bytes(File): $bytesInFile\n"
// "Bytes Read from File: $bytesRead\n"
// "Bytes download: $bytesDownload";
5
likes
0
pub points
65%
popularity

Publisher

unverified uploader

Cache Http request in file system. Provide json/bytes and Image interface.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, path_provider, quiver

More

Packages that depend on file_cache