Before reading or writing any data you must open a database handle. Cindel’s entry point isDocumentation 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.
Cindel.open, a static Future on the Cindel class that initialises the native engine, registers your generated schemas, and returns a CindelDatabase ready for use. The same call works on native platforms (iOS, Android, macOS, Windows, Linux) and on Flutter Web — the underlying backend is selected automatically or explicitly through the backend parameter.
Cindel.open
Parameter Reference
| Parameter | Type | Required | Description |
|---|---|---|---|
directory | String | ✅ | Path to a writable directory where database files are stored. On Flutter Web, pass a short string name (not a filesystem path) — it becomes the OPFS origin-private storage name. Must not be empty. |
schemas | Iterable<CindelCollectionSchema> | — | Generated schema objects for every collection the app reads or writes. Pass the XyzSchema constant emitted by the generator (e.g. UserSchema). |
backend | CindelStorageBackend | — | Storage engine. Defaults to CindelStorageBackend.mdbx. Pass CindelStorageBackend.sqlite to select SQLite explicitly on native. Web always uses SQLite/OPFS regardless of this value. |
migrationPlan | CindelMigrationPlan? | — | Versioned migration plan executed before the final handle is opened. See the Migrations page for details. |
sync | CindelSyncConfig? | — | Experimental local-first sync configuration. See the Sync page for details. |
MDBX (Default)
MDBX is the default backend for new Cindel databases on native platforms. It uses a memory-mapped B-tree file format with very low read overhead and is the recommended backend for most Flutter apps.backend defaults to CindelStorageBackend.mdbx, no explicit backend argument is needed.
SQLite (Explicit)
Select SQLite when you need the native SQLite backend — for example, when your app already relies on SQLite tooling, you need SQL-level introspection, or you are integrating with an existing SQLite database file:Choosing a Backend
| MDBX | SQLite | |
|---|---|---|
| Default on native | ✅ | No |
| Flutter Web | No | ✅ (OPFS) |
| Recommended for new apps | ✅ | When you specifically need SQLite |
| SQL-level tooling | No | ✅ |
In-Memory Database (Tests)
Cindel.openInMemory opens a database that lives only in memory. Data is discarded when the handle is closed, making it ideal for fast unit tests:
openInMemory accepts schemas, backend, and sync — the same as open minus directory and migrationPlan.
Flutter Web
On the Web,directory is a short string identifier used as the OPFS storage origin name rather than a filesystem path. Pass a consistent name across restarts so data is reloaded correctly:
cindel and cindel_flutter_libs in your pubspec.yaml:
Closing a Database
Callclose() on the returned CindelDatabase to flush any pending state and release native resources. Calling close() more than once is safe:
addTearDown(db.close) so every test cleans up even when it fails.
migrationPlan and sync are each covered in their own pages. See the Migrations and Sync sections for full examples.