Skip to content
pubscout

mmkv

2.4.3, released 5 weeks ago by weixin.com

An efficient, small mobile key-value storage framework.

Rock solid
$ flutter pub add mmkv
Source repository

What it does

MMKV uses mmap to keep memory synced with files and protobuf to encode/decode values, providing fast key-value storage. It supports primitive types, strings, bytes, multi-process concurrency, and optional encryption.

AI-written summary of version 2.4.3, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need a high-performance key-value storage solution on mobile or desktop.
  • You require multi-process concurrent access to the same storage files.

Skip it when

  • You require complex relational queries, which are better suited for a SQL database.
  • You need built-in reactive streams for data observation.

Strengths

  • Extremely efficient memory and file synchronization via mmap.
  • Small binary footprint and lightweight dependencies.
  • Supports multi-process concurrency.

Weaknesses

  • Must wait for MMKV initialization to finish before accessing instances.
  • Limited built-in data types compared to NoSQL document databases.

Setup

Kind
Plugin (native code)
Effort
Low
Code generation
No
Direct dependencies
7

Call MMKV.initialize() in main() before running the app.

void main() async {
  final rootDir = await MMKV.initialize();
  var mmkv = MMKV.defaultMMKV();
  mmkv.encodeBool('bool', true);
  print('bool = ${mmkv.decodeBool("bool")}');
  runApp(MyApp());
}

Alternatives

Packages that do the same job and could replace mmkv.

Works with

Packages commonly used together with mmkv: ones it builds on, ones built on it, and its own family.