hive
2.2.3, released 4 years ago by isar.dev
Fast, pure Dart key-value store with optional AES-256 encryption
WASM-readyQuiet but busy
What it does
Hive is a lightweight NoSQL database that stores data as key-value pairs. It supports cross‑platform use (mobile, desktop, web) and can encrypt data on disk.
AI-written summary of version 2.2.3, based on the package's README and metadata. Report an inaccuracy
Use it when
- Need fast local storage for small to medium data sets
- Require encryption without native dependencies
- Want a simple API that works in Flutter and pure Dart
- Need to store custom Dart objects with adapters
Skip it when
- Working with large relational data sets
- Need complex queries or joins
- Require server‑side sync or offline sync features
Strengths
- High read/write performance
- No native dependencies, pure Dart
- Built‑in AES‑256 encryption
- Supports custom object adapters
Weaknesses
- No query language or relational support
- Requires manual adapter generation for custom types
- Limited to key‑value access patterns
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 2
Add hive and hive_flutter, call Hive.initFlutter(), register adapters with Hive.registerAdapter(), open boxes with Hive.openBox()
import 'package:hive/hive.dart';
var box = Hive.box('settings');
box.put('darkMode', true);
var dark = box.get('darkMode');Alternatives
Packages that do the same job and could replace hive.
- shared_preferences
Simple key‑value storage for small settings
97Compare - sqflite
Relational database when complex queries are needed
96Compare
Works with
Packages commonly used together with hive: ones it builds on, ones built on it, and its own family.
- cryptohive depends on itProvides SHA, MD5, and HMAC hashing functions for Dart.
- hive_flutterBuilt on hiveFlutter extension for Hive providing easy initialization and adapters for common types.
- hive_generatorBuilt on hiveGenerates Hive TypeAdapter code for Dart classes automatically.
- autotrieBuilt on hiveAn auto-completion engine for Dart and Flutter using an optimized Trie implementation.
- hive_testBuilt on hiveInitialize a temporary Hive database for unit tests
- at_clientBuilt on hiveClient SDK for building apps on the atProtocol with end-to-end encryption.
- firebase_dartBuilt on hiveA pure Dart implementation of Firebase Authentication, Realtime Database, and Cloud Storage.
- algolia_insightsBuilt on hiveFlutter client for sending Algolia Insights events like clicks, conversions, and views.