omni_kv_hive_ce 0.1.0 copy "omni_kv_hive_ce: ^0.1.0" to clipboard
omni_kv_hive_ce: ^0.1.0 copied to clipboard

Hive CE adapter for the OmniKV framework.

OmniKV: Hive CE #

pub package

The official hive_ce adapter for OmniKV.

Installation #

You must install both the adapter and the underlying storage package:

flutter pub add omni_kv omni_kv_hive_ce hive_ce

Quick Start #

Initialize your KvGateway with the HiveCeKvAdapter:

import 'package:omni_kv/omni_kv.dart';
import 'package:omni_kv_hive_ce/omni_kv_hive_ce.dart';
import 'package:hive_ce/hive.dart';

Future<void> main() async {
  // Ensure Hive is initialized for your platform first!
  // await Hive.initFlutter();
  
  final box = await Hive.openBox<Object?>('settings');
  
  final kv = KvGateway(
    HiveCeKvAdapter(
      box,
      codec: const HiveCeKvCodec(prefix: 'my_app.'),
    ),
  );

  // Ready to use!
}

Features #

  • Watchable Streams: Because Hive CE natively supports watching boxes, this adapter implements WatchableKvCapability. You can call .watch() on any key to get a continuous stream of changes.
  • Native Maps: Hive natively supports raw Maps and Lists. If you use ModelConverter.toMap() or RecordConverter.toMap() on your keys, data will be stored natively instead of being stringified to JSON.
  • Scoped Clearing: If you provide a prefix to the codec, calling kv.clear() will only delete keys that start with that prefix from the Hive box.

For full documentation on how to define keys and use the fluent API, see the core OmniKV package.

0
likes
140
points
79
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Hive CE adapter for the OmniKV framework.

Homepage
Repository (GitHub)
View/report issues

Topics

#hive #hive-ce #key-value #storage #database

License

MIT (license)

Dependencies

hive_ce, omni_kv

More

Packages that depend on omni_kv_hive_ce