hive_local_storage
3.0.1, released 6 weeks ago by kishormainali.com
A wrapper around hive_ce for easy local data storage and encryption.
What it does
It wraps hive_ce and flutter_secure_storage to provide an easy interface for storing, encrypting, and caching local key-value data and custom models. It features per-box locks, custom box opening, and error recovery for corrupted boxes.
AI-written summary of version 3.0.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need encrypted local storage or key-value caching in Flutter.
- You want to manage custom typed models in Hive boxes with built-in encryption key management.
Skip it when
- You require complex relational database queries or SQL support.
- You need native multi-process database access.
Strengths
- Automatic encryption key storage via flutter_secure_storage
- Per-box locks for improved write performance
- Handles corrupted cache boxes automatically during initialization
Weaknesses
- Relies on Hive and requires code generation for complex custom objects
- Breaking changes removed the built-0in session/token management in version 3.0.0
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- Yes (build_runner)
- Direct dependencies
- 6
Initialize via LocalStorage.initialize(). Optionally use hive_ce_generator and build_runner for custom object adapters.
await LocalStorage.initialize();
await LocalStorage.i.put<int>(key: 'count', value: 0);
final count = LocalStorage.i.get<int>(key: 'count');Alternatives
Packages that do the same job and could replace hive_local_storage.
Works with
Packages commonly used together with hive_local_storage: ones it builds on, ones built on it, and its own family.
- flutter_secure_storagehive_local_storage depends on itSecure key-value storage using platform-specific secure mechanisms
- synchronizedhive_local_storage depends on itLock mechanism to prevent concurrent access to asynchronous code.
- pointycastlehive_local_storage depends on itA Dart library providing a wide range of cryptographic algorithms and primitives.
- hive_cehive_local_storage depends on itA lightweight and fast NoSQL key-value database written in pure Dart.
- hive_ce_flutterhive_local_storage depends on itFlutter extension for Hive database initialization and path management