dcache 0.0.1

  • README.md
  • Installing
  • Versions
  • 77


Dcache is a simple library to implement application caching in dart inspired by gcache


  • Supports expirable Cache, LFU, LRU.
  • Support eviction
  • Automatically load cache if it doesn't exists. (Optional)
  • Async loading of expirate value


Simple use case

import 'package:dcache/dcache.dart';

void main() {
  Cache c = new SimpleCache(storage: new SimpleStorage(size: 20));

    c.set("key", 42);
    print(c.get("key")); // 42
    print(c.containsKey("unknown_key")); // false
    print(c.get("unknown_key")); // nil

Loading function

import 'package:dcache/dcache.dart';

void main() {
  Cache c = new SimpleCache<int, int>(storage: new SimpleStorage(size: 20))
    ..loader = (key, oldValue) => key*10

    print(c.get(4)); // 40
    print(c.get(5)); // 50
    print(c.containsKey(6)); // false



Use this package as a library

1. Depend on it

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

  dcache: "^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:dcache/dcache.dart';
Version Uploaded Documentation Archive
0.0.1 Mar 3, 2017 Go to the documentation of dcache 0.0.1 Download dcache 0.0.1 archive


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

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3


Describes how popular the package is relative to other packages. [more]
77 / 100
Code health derived from static analysis. [more]
92 / 100
Reflects how tidy and up-to-date the package is. [more]
56 / 100
Overall score:
Weighted score of the above. [more]
Learn more about scoring.


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:dcache/dcache.dart.


  • Maintain CHANGELOG.md.

    Changelog entries help clients to follow the progress in your code.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 1 error 2 hints.

    Strong-mode analysis of lib/src/cache.dart failed with the following error:

    line: 94 col: 24
    A value of type '(K, V) → V' can't be assigned to a variable of type '(dynamic, dynamic) → dynamic'.

    Run dartfmt to format lib/src/cache/simple_cache.dart.

    Similar analysis of the following files failed:

    • lib/src/storage/simple_storage.dart (hint)
  • Package is getting outdated.

    The package was released 67 weeks ago.

  • 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 API.

  • Maintain an example.

    None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use dcache.dart.

  • Use analysis_options.yaml.

    Rename old .analysis_options file to analysis_options.yaml.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <2.0.0
meta ^1.0.4 1.1.5
Dev dependencies
test ^0.12.20+1