Vyuh Framework
Build Modular, Scalable, CMS-driven Flutter Apps
Vyuh Hive Storage Plugin π¦
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