TODO: Put a short description of the package here that helps potential users know whether this package might be useful for them.
Features
A general framework for caching dart object model in Hive. This package currently support JSON parsable objects and, Hive types.
Getting started
To start using the package go through Hive basics
To utilize this package register your data models before initializing the Cache Store. Also, don't forget to initialize Hive beforehand.
Usage
- Initializing store JSON Parsable Object and, Hive Typed Object.
import 'package:hive_universal_cache/hive_universal_cache.dart';
final store = CacheStore(name: "test", policy: CachePolicy.main);
CacheTypeRegistry.instance.registerJsonAdapter<TestModel>(TestModel.fromJson);
CacheTypeRegistry.instance.registerHiveTypeAdapter<HiveTestModel>(HiveTestModelAdapter());
store.init();
- Set and, Get example
await store.set<TestModel>("test", TestModel(key: "test"));
final data = await store.get<TestModel>("test");
For more detailed examples, kindly go to Examples
Additional information
This package is just on the initial phase, next inclusions will be :
- Wrapper over http to directly put cacheable content.
- Adding support for Images and, Files.