Skip to content
pubscout

sembast

3.10.1, released 11 days ago by tekartik.com

A NoSQL persistent embedded document-based database for Dart and Flutter.

WASM-readyRock solid
$ flutter pub add sembast
Source repository

What it does

Sembast stores documents in a single file or in-memory, supporting transactions, encryption via codecs, and change listeners. It works across all platforms without requiring native plugins.

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

Use it when

  • You need a simple, single-file NoSQL database for local storage
  • You want support across all platforms including Flutter Web and desktop without native plugins
  • You need transactional writes and query filtering on JSON-compatible maps

Skip it when

  • You need complex relational queries or multi-table joins
  • You are dealing with massive datasets that exceed memory limits, as the database loads entirely in memory when opened

Strengths

  • Pure Dart implementation with 100% platform support
  • Supports encryption via custom codecs
  • Familiar document-store paradigm with transaction support and change listeners

Weaknesses

  • Loads the entire database into memory when opened
  • Not suited for complex relational data modeling

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
3

No native plugin setup required; simply add path_provider to locate the database file on Flutter.

import 'package:path/path.dart';
import 'package:path_provider/path_provider.dart';
import 'package:sembast/sembast_io.dart';

final dir = await getApplicationDocumentsDirectory();
await dir.create(recursive: true);
final dbPath = join(dir.path, 'my_database.db');
final db = await databaseFactoryIo.openDatabase(dbPath);

var store = StoreRef.main();
await store.record('title').put(db, 'Simple application');

Alternatives

Packages that do the same job and could replace sembast.

  • hive_ce

    If you want a lightweight key-value and box-based NoSQL database optimized for speed.

  • sqflite

    If you prefer a traditional relational SQL database for SQLite-supported platforms.

  • shared_preferences

    If you only need to store simple key-value configuration data.

Works with

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