Skip to content

File cached for json, bytes; FileCacheImage for flutter

License

Notifications You must be signed in to change notification settings

pedia/file_cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

file_cache

Cached Json, Bytes(Image) in file for Http response.

Dart2 and null-safety ready.

Getting Started

import 'package:file_cache/file_cache.dart';

// Create the instance of FileCache
FileCache fileCache = await FileCache.fromDefault();

// Usage: get 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
new Image(
    fit: BoxFit.cover,
    image: new FileCacheImage('http://httpbin.org/images/jpeg'),
);

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

// Usage: statistics
print(fileCache.stats.toString());
// "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";

About

File cached for json, bytes; FileCacheImage for flutter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages