Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/mainser/cindel/llms.txt

Use this file to discover all available pages before exploring further.

Flutter Web apps use the same Cindel.open call and the same generated typed collections as any other platform. Under the hood, Cindel detects the Web platform and routes through a SQLite Worker and Wasm runtime with OPFS persistence — there is no MDBX in the browser, and no browser-specific code to write in your app. Because Web support is still experimental, you should validate your app in the target browser before shipping.

How Web storage works

On native platforms Cindel defaults to MDBX. On the Web, MDBX is not a browser backend. Instead, Cindel.open transparently switches to a SQLite Worker that runs the Rust Wasm module in a dedicated Web Worker thread and persists data through the Origin Private File System (OPFS) API. OPFS requires a secure context — your app must be served over HTTPS or from localhost. Pages served over plain HTTP cannot access OPFS and the database will fail to open.

Required packages

Every Flutter Web app that uses Cindel needs both packages. cindel_flutter_libs bundles the Worker JS, the Wasm binary, and the SQLite glue assets — Flutter’s build system picks them up automatically during flutter build web. No manual pubspec.yaml asset declarations are needed.
dependencies:
  cindel: ^0.9.1
  cindel_flutter_libs: ^0.9.1

dev_dependencies:
  build_runner: ^2.15.0
  cindel_generator: ^0.9.1
The cindel_flutter_libs Web assets are:
FilePurpose
web/cindel_worker.jsWorker bootstrap and scheduling
web/pkg/cindel_native.jsWasm JS glue
web/pkg/cindel_native_bg.wasmCompiled Rust + SQLite runtime

Opening a database

The call is identical to native. Cindel’s platform detection is internal — there is no CindelStorageBackend.web option to pass, and no import to change.
import 'package:cindel/cindel.dart';

final db = await Cindel.open(
  directory: 'app.db',
  schemas: [UserSchema],
);
On native, directory is a file-system path. On Web, it is the OPFS database name. Pass the same string on every open to reopen the persisted database.

What is supported on Web

The following typed API surface works on Flutter Web:
  • Typed put, putAll, get, getAll, delete, deleteAll
  • Generated where() and filter() query helpers
  • findAll, findFirst, count
  • Sorting and pagination
  • Explicit readTxn and writeTxn
  • Single-tab typed object, collection, and query watchers

What is not supported / experimental

The following are outside the current Web preview:
  • MDBX — not a browser backend; SQLite/OPFS is the only Web path
  • Multi-tab coordination — multiple browser tabs targeting the same OPFS database are not coordinated in the current preview
  • Query updates (updateAll) — explicitly rejected when sync is enabled on any platform, including Web
Web support is experimental. Always validate your app in the target browser before shipping — OPFS availability, storage quota, and Worker loading behavior vary across browser versions.
Multi-tab coordination is not part of the current Web preview. Running the same OPFS database from more than one tab simultaneously is unsupported and may produce unexpected behavior.

Backup and compression on Web

CindelBackup.exportDatabase and CindelBackup.importDatabase work on Web. Native Dart uses gzip compression by default, but gzip is not available in the browser Wasm runtime. If you need a cross-platform archive that can be imported on both native and Web, pass compression: CindelBackupCompression.none explicitly on all platforms.
CindelBackupCompression.gzip falls back to .none on Web. To produce an archive that is portable across Web and native, pass compression: CindelBackupCompression.none explicitly — do not rely on the automatic fallback.
// Cross-platform safe: explicit uncompressed archive
await CindelBackup.exportDatabase(
  database: db,
  collections: [CindelBackupCollection(UserSchema)],
  output: output,
  compression: CindelBackupCompression.none,
);

Full setup example

# pubspec.yaml
dependencies:
  flutter:
    sdk: flutter
  cindel: ^0.9.1
  cindel_flutter_libs: ^0.9.1

dev_dependencies:
  build_runner: ^2.15.0
  cindel_generator: ^0.9.1
import 'package:cindel/cindel.dart';

// Works on native and Web — no platform branches needed.
final db = await Cindel.open(
  directory: 'app.db',
  schemas: [UserSchema],
);

final user = User()
  ..email = 'ada@example.com'
  ..name = 'Ada Lovelace';

await db.users.put(user);

final saved = await db.users.get(user.dbId);

Build docs developers (and LLMs) love