Skip to content
pubscout

sembast_web

2.4.7, released 11 days ago by tekartik.com

NoSQL persistent embedded database for the Web on top of IndexedDB.

WASM-readyRock solid
$ flutter pub add sembast_web
Source repository

What it does

Provides a NoSQL embedded database implementation for web applications using IndexedDB as the underlying storage. It supports cross-tab synchronization and transactions.

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

Use it when

  • You need a NoSQL embedded database specifically for Flutter Web or browser applications.
  • You want data to synchronize across multiple open browser tabs.

Skip it when

  • You are looking for a relational SQL database solution.
  • You require built-in data encryption via codecs (which are not supported).

Strengths

  • Content and transactions are synchronized across all open browser tabs.
  • Supports both JS and WASM targets.

Weaknesses

  • Codecs are not supported on the web.
  • Transactions must be idempotent because they may run again in case of concurrent access.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
4

Add sembast_web to your pubspec.yaml dependencies.

import 'package:sembast/sembast.dart';
import 'package:sembast_web/sembast_web.dart';

Future main() async {
  var store = intMapStoreFactory.store();
  var factory = databaseFactoryWeb;
  var db = await factory.openDatabase('test');
  var key = await store.add(db, <String, Object?>{'name': 'Table', 'price': 15});
  var value = await store.record(key).get(db);
  print(value);
  await db.close();
}

Alternatives

Packages that do the same job and could replace sembast_web.

Works with

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