vyuh_plugin_storage_hive 1.1.2 copy "vyuh_plugin_storage_hive: ^1.1.2" to clipboard
vyuh_plugin_storage_hive: ^1.1.2 copied to clipboard

Hive storage plugin for Vyuh

Vyuh Hive Storage Plugin ๐Ÿ“ฆ #

vyuh_plugin_storage_hive

A storage plugin for Vyuh using Hive as the backend. This plugin provides a simple yet powerful key-value storage solution that integrates seamlessly with the Vyuh framework.

Features โœจ #

  • Key-value Storage ๐Ÿ”‘: Simple and fast storage using Hive
  • Configurable Box Name ๐Ÿ“: Customize storage location for different use cases
  • Auto-initialization ๐Ÿš€: Automatic setup and cleanup
  • Type Safety ๐Ÿ›ก๏ธ: Full type safety for stored values
  • Persistence ๐Ÿ’พ: Data persists across app restarts

Installation ๐Ÿ“ฆ #

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

dependencies:
  vyuh_plugin_storage_hive: any

Usage ๐Ÿ’ก #

Plugin Registration ๐Ÿ”Œ #

Register the storage plugin with your Vyuh application:

import 'package:vyuh_core/vyuh_core.dart' as vc;
import 'package:vyuh_plugin_storage_hive/vyuh_plugin_storage_hive.dart';

void main() {
  vc.runApp(
    plugins: PluginDescriptor(
      // ... other plugins
      storage: HiveStoragePlugin(), // default box name
      // OR
      storage: HiveStoragePlugin(boxName: 'my_custom_box'),
    ),
    features: () => [
      // your features
    ],
  );
}

Storage Operations ๐Ÿ”„ #

Access and manipulate stored data:

// Get the storage plugin
final storage = vyuh.getPlugin<StoragePlugin>();

// Write data โœ๏ธ
await storage.write('key', 'value');

// Read data ๐Ÿ“–
final value = await storage.read('key');

// Check if key exists ๐Ÿ”
final exists = await storage.has('key');

// Delete data ๐Ÿ—‘๏ธ
await storage.delete('key');

Implementation Details ๐Ÿ› ๏ธ #

  • Hive Backend ๐Ÿ“Š: Uses Hive's Box for efficient storage
  • Custom Storage ๐Ÿ—„๏ธ: Data stored in configurable box (defaults to 'vyuh_storage')
  • Flutter Support ๐Ÿ“ฑ: Automatic Hive initialization for Flutter
  • Resource Management ๐Ÿงน: Proper cleanup on plugin disposal

Configuration โš™๏ธ #

Box Name Configuration ๐Ÿ“ #

Customize the storage location by specifying a box name:

vc.runApp(
  plugins: PluginDescriptor(
    storage: HiveStoragePlugin(boxName: 'my_custom_box'),
  ),
  // ...
);

This configuration enables:

  • ๐Ÿ”€ Multiple storage boxes for different purposes
  • ๐Ÿ”’ Data isolation between features
  • ๐Ÿค Data sharing across app components

Learn More ๐Ÿ“š #

License ๐Ÿ“„ #

This project is licensed under the terms specified in the LICENSE file.