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
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.
Works with
Packages commonly used together with sembast: ones it builds on, ones built on it, and its own family.
- synchronizedsembast depends on itLock mechanism to prevent concurrent access to asynchronous code.
- sqflite_commonSame familyDart wrapper on SQLite providing the common API for sqflite and desktop FFI implementations.
- sqflite_common_ffiSame familyFFI-based implementation of sqflite for desktop platforms and unit tests.
- process_runSame familyRun shell scripts and locate executables across Linux, Windows and macOS.
- sqflite_common_ffi_webSame familySqflite web implementation using sqlite3 ffi and sqlite3 wasm.
- idb_sqfliteSame familyIndexedDB API implementation on top of sqflite for Flutter and Dart VM
- idb_shimBuilt on sembastCross-platform IndexedDB implementation for Dart and Flutter.
- sembast_webBuilt on sembastNoSQL persistent embedded database for the Web on top of IndexedDB.