cache_store 0.6.6

cache_store #

A Dart store for caching instances to various backends (memory, file, ...).

Quickstart #

Future<Cache<int>> update(String key) async {
  await Future.delayed(const Duration(seconds: 2));
  return Cache.fromNow(
    key: key,
    value: 42,
    expiresIn: const Duration(seconds: 1),
  );
}

final store = MemoryCacheStore<int>();

var entry = await store.get("test", ifExpired: update);

Use this package as a library

1. Depend on it

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


dependencies:
  cache_store: ^0.6.6

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:cache_store/cache_store.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
40
Health:
Code health derived from static analysis. [more]
97
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
60
Overall:
Weighted score of the above. [more]
61
Learn more about scoring.

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

  • Dart: 2.5.0
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, other

Primary library: package:cache_store/cache_store.dart with components: io.

Health suggestions

Fix lib/src/stores/file_store.dart. (-2.48 points)

Analysis of lib/src/stores/file_store.dart reported 5 hints:

line 3 col 8: Unused import: 'dart:typed_data'.

line 40 col 5: Future results in async function bodies must be awaited or marked unawaited using package:pedantic.

line 47 col 5: Future results in async function bodies must be awaited or marked unawaited using package:pedantic.

line 54 col 5: Future results in async function bodies must be awaited or marked unawaited using package:pedantic.

line 73 col 5: Future results in async function bodies must be awaited or marked unawaited using package:pedantic.

Fix lib/src/serializers/list_serializer.dart. (-0.50 points)

Analysis of lib/src/serializers/list_serializer.dart reported 1 hint:

line 1 col 8: Unused import: 'package:cache_store/src/helpers/serialization.dart'.

Fix lib/src/stores/base_store.dart. (-0.50 points)

Analysis of lib/src/stores/base_store.dart reported 1 hint:

line 43 col 7: Future results in async function bodies must be awaited or marked unawaited using package:pedantic.

Fix additional 7 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/cache_store.dart (Run dartfmt to format lib/cache_store.dart.)
  • lib/src/cache.dart (Run dartfmt to format lib/src/cache.dart.)
  • lib/src/errors/update.dart (Run dartfmt to format lib/src/errors/update.dart.)
  • lib/src/helpers/updates.dart (Run dartfmt to format lib/src/helpers/updates.dart.)
  • lib/src/serializers/serializer.dart (Run dartfmt to format lib/src/serializers/serializer.dart.)
  • lib/src/stores/memory_store.dart (Run dartfmt to format lib/src/stores/memory_store.dart.)
  • lib/src/stores/store.dart (Run dartfmt to format lib/src/stores/store.dart.)

Maintenance issues and suggestions

Provide a file named CHANGELOG.md. (-20 points)

Changelog entries help developers follow the progress of your package. See the example generated by stagehand.

Homepage URL doesn't exist. (-20 points)

At the time of the analysis the homepage field https://github.com/aloisdeniel/cache_store was unreachable.

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and cache_store.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
meta ^1.1.6 1.1.7