vyuh_plugin_storage_hive 1.1.2 vyuh_plugin_storage_hive: ^1.1.2 copied to clipboard
Hive storage plugin for Vyuh
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
Learn More ๐ #
- Visit docs.vyuh.tech for detailed documentation
- Check out the GitHub repository for source code
- Report issues on the issue tracker
License ๐ #
This project is licensed under the terms specified in the LICENSE file.