file_cache 0.0.1

  • Installing
  • Versions
  • 11


File cached Json,Buffer,FileCacheImage for flutter package project.

<font color="green">Dart2 Ready</font>

Getting Started

import 'package:file_cache/file_cache.dart';

// Provider a Loader function for Http request;
Future<HttpClientResponse> loader(String url) async {
  final Uri uri = Uri.parse(url);

  HttpClientRequest request = await httpClient.getUrl(uri);
  return await request.close();

// Create the instance of FileCache
FileCache fileCache = await FileCache.fromDefault(
  httpClient: httpClient,
  loader: loader,

// Usage: get Json map
Map data = await fileCache.getJson(url);

// Usage: get bytes
Uint8List bytes = await fileCache.getBytes(url);

// Usage: replace NetworkImage
new Image(
    fit: BoxFit.cover,
    image: new FileCacheImage(url),

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

// Usage: statistics
// "Bytes(Memory): $bytesInMemory\n"
// "Miss(Memory): $missInMemory\n"
// "Hit(Memory): $hitMemory\n"
// "Bytes(File): $bytesInFile\n"
// "Bytes Read from File: $bytesRead\n"
// "Bytes download: $bytesDownload";

[0.0.1] - initial version

  • getJson/getBytes
  • clean
  • stats
  • FileCacheImage

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  file_cache: ^0.0.1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:file_cache/file_cache.dart';
Version Uploaded Documentation Archive
0.0.1 Apr 13, 2018 Go to the documentation of file_cache 0.0.1 Download file_cache 0.0.1 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Fix dependencies in pubspec.yaml.

Running flutter packages pub upgrade failed with the following output:

ERR: The current Dart SDK version is 2.1.0-dev.9.4.flutter-f9ebf21297.
 Because file_cache depends on quiver >=0.3.0 <=0.29.0+1 which requires SDK version <2.0.0, version solving failed.

Maintenance issues and suggestions

Add SDK constraint in pubspec.yaml. (-50 points)

For information about setting SDK constraint, please see

Fix platform conflicts. (-20 points)

Error(s) prevent platform classification:

Fix dependencies in pubspec.yaml.

Running dartdoc failed. (-10 points)

Make sure dartdoc runs without any issues.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use file_cache.dart.

Package is pre-v0.1 release. (-10 points)

While there is nothing inherently wrong with versions of 0.0.*, it usually means that the author is still experimenting with the general direction of the API.