file_cache 0.0.1

  • Installing
  • Versions
  • 73


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 Flutter:

$ flutter packages get

Alternatively, your editor might support 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.

We analyzed this package on Aug 10, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.11.8
  • Flutter: 0.5.7


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Issues and suggestions

Add SDK constraint in pubspec.yaml.

For information about setting SDK constraint, please see

Package is pre-v1 release.

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

Maintain an example.

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.

Fix lib/src/file_cache.dart.

Analysis of lib/src/file_cache.dart reported 3 hints:

line 215 col 47: 'DIRECTORY' is deprecated and shouldn't be used.

line 257 col 54: 'CACHE_CONTROL' is deprecated and shouldn't be used.

line 348 col 43: 'OK' is deprecated and shouldn't be used.

Format lib/src/consolidate_response.dart.

Run flutter format to format lib/src/consolidate_response.dart.

Format lib/src/file_cache_image.dart.

Run flutter format to format lib/src/file_cache_image.dart.


Package Constraint Resolved Available
Direct dependencies
flutter 0.0.0
path_provider >=0.4.0 <0.5.0 0.4.1
quiver >=0.28.0 <0.29.0 0.28.2 2.0.0+1
Transitive dependencies
collection 1.14.6 1.14.11
matcher 0.12.4
meta 1.1.5 1.1.6
path 1.6.2
sky_engine 0.0.99
stack_trace 1.9.3
typed_data 1.1.5 1.1.6
vector_math 2.0.6 2.0.8
Dev dependencies
test any