Skip to content
pubscout

sembast_sqflite

2.2.4+2, released 11 days ago by tekartik.com

Sembast NoSQL database support built on top of sqflite for cross-process safety.

WASM-ready
$ flutter pub add sembast_sqflite
Source repository

What it does

Provides a NoSQL document database API backed by an SQLite journaling layer. It enables fast in-memory access combined with cross-process safe database storage and transactions.

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

Use it when

  • You need a NoSQL Sembast database interface that is cross-process safe.
  • You want fast in-memory NoSQL access backed by SQLite storage.

Skip it when

  • You are using multiple isolates to access the same sembast_sqflite database (it should be used from the main isolate only).
  • You want standard raw SQLite queries without a NoSQL abstraction layer.

Strengths

  • Cross-process safe database storage and transaction mechanism.
  • Familiar Sembast NoSQL API backed by sqflite.

Weaknesses

  • Should be used from the main isolate only.
  • Can encounter locked access if multiple transactions are in progress concurrently.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
5

Follow setup instructions for platform-specific dependencies required by sqflite.

import 'package:sembast_sqflite/sembast_sqflite.dart';
import 'package:sqflite/sqflite.dart' as sqflite;

Future main() async {
  final factory = getDatabaseFactorySqflite(sqflite.databaseFactory);
  var store = StoreRef<String, String>.main();
  var record = store.record('my_key');
  var db = await factory.openDatabase('test.db');
  await record.put(db, 'my_value');
  print(await store.stream(db).first);
  await db.close();
}

Alternatives

Packages that do the same job and could replace sembast_sqflite.

  • drift

    If you prefer a robust, type-safe reactive SQL database library for Flutter.

  • hive_ce

    If you need a pure key-value NoSQL database without relying on an SQLite engine.

Works with

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