hive_cache 0.1.3

  • Readme
  • Changelog
  • Example
  • Installing
  • new61

hive_cache #

A new Flutter package project.

Getting Started #

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

[0.1.3] - 2019-10-26

  • Fix minor issues.

[0.1.2] - 2019-10-26

  • Fix minor issues.

[0.1.1] - 2019-10-26

  • Add getChildrenOfType method.

[0.1.0] - 2019-10-17

  • HiveCache now works the other way around - items depend on their parents. So now, there are put(key, parent, value), get(key), setRootKeys(keys) and getRootKeys().

[0.0.1] - 2019-10-16

  • HiveCache supports put(key, value), get(key), putChildren(key, children), getChildren(key), putRootChildren(children) and getRootChildren().

example/lib/main.dart

import 'package:hive/hive.dart';
import 'package:hive_cache/hive_cache.dart';

void main() async {
  await Hive.init('.');
  final cache = HiveCache();
  await cache.initialize();
  await cache.setRootKeys(['fruits', 'nuts']);
  await cache.put('apple', 'fruits', 2);
  await cache.put('other', 'fruits', 3);
  await cache.put('some', 'fruits', 'string');
  print(await cache.getChildrenOfType<int>('fruits'));
  print(await cache.getChildrenOfType<String>('fruits'));
}

Use this package as a library

1. Depend on it

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


dependencies:
  hive_cache: ^0.1.3

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:hive_cache/hive_cache.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
31
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
61
Learn more about scoring.

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

  • Dart: 2.6.0
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

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

Health issues and suggestions

Document public APIs. (-1 points)

11 out of 11 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/hive_cache.dart. (-1 points)

Analysis of lib/hive_cache.dart reported 2 hints:

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

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

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.2 <3.0.0
hive ^1.0.0 1.1.1
Transitive dependencies
meta 1.1.8
path 1.6.4
pointycastle 1.0.1