Skip to content
pubscout

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.

WASM-ready
$ flutter pub add hive_local_storage
Source repository

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.