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

Hive storage plugin for Vyuh

Vyuh Logo

Vyuh Framework

Build Modular, Scalable, CMS-driven Flutter Apps

Docs | Website

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

Made with ❀️ by Vyuh