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.

Cindel’s runtime and code generator are distributed as standard pub packages. Flutter apps need two runtime packages (cindel and cindel_flutter_libs) plus the generator as a dev dependency. Pure Dart tools need only cindel and a path to the native library at runtime. This page covers every installation scenario, from a fresh Flutter project to a Freezed model setup and platform-specific native library requirements.

Flutter Apps

Flutter apps are the primary use case for Cindel. Add cindel and cindel_flutter_libs as runtime dependencies, then add build_runner and cindel_generator as dev dependencies.
dependencies:
  cindel: ^0.9.1
  cindel_flutter_libs: ^0.9.1

dev_dependencies:
  build_runner: ^2.15.0
  cindel_generator: ^0.9.1
cindel_flutter_libs bundles the prebuilt native libraries for Android, iOS, macOS, Windows, and Linux, and the Worker/Wasm runtime assets for Flutter Web. You do not need to import anything from it in Dart — its presence in pubspec.yaml is enough for Flutter’s platform build to locate and embed the correct runtime files. Your application code imports only the runtime package:
import 'package:cindel/cindel.dart';

Pure Dart Tools

Pure Dart command-line tools and server-side programs can depend on cindel directly without cindel_flutter_libs. The cindel package loads the native library from the path stored in the CINDEL_NATIVE_LIBRARY environment variable when Flutter’s asset bundling is not available.
dependencies:
  cindel: ^0.9.1

dev_dependencies:
  build_runner: ^2.15.0
  cindel_generator: ^0.9.1
Set the environment variable before running dart tests or tools:
# Linux / macOS
export CINDEL_NATIVE_LIBRARY=/path/to/libcindel_native.so
dart run bin/my_tool.dart
# Windows PowerShell
$env:CINDEL_NATIVE_LIBRARY = 'D:\path\to\cindel_native.dll'
dart run bin/my_tool.dart

Build Runner

The cindel_generator package is a build_runner builder. It reads @Collection, @Index, @Embedded, and related annotations from your model files and emits *.g.dart part files that the cindel runtime consumes. Run a one-off build after adding or modifying model files:
dart run build_runner build --delete-conflicting-outputs
During active development, use watch mode to regenerate automatically whenever a source file changes:
dart run build_runner watch --delete-conflicting-outputs
The --delete-conflicting-outputs flag lets build_runner overwrite previously generated files when you rename or refactor a model. Commit the generated *.g.dart files to version control alongside your model sources.

Freezed Support

Cindel supports Freezed classic classes and single primary-factory models. If your project uses Freezed, add freezed_annotation as a runtime dependency and freezed as a dev dependency alongside the Cindel packages:
dependencies:
  cindel: ^0.9.1
  cindel_flutter_libs: ^0.9.1
  freezed_annotation: ^3.1.0

dev_dependencies:
  build_runner: ^2.15.0
  cindel_generator: ^0.9.1
  freezed: ^3.2.3
A Freezed primary-factory model requires two part directives — one for Freezed’s output and one for Cindel’s output:
import 'package:cindel/cindel.dart';
import 'package:freezed_annotation/freezed_annotation.dart';

part 'product.freezed.dart';
part 'product.g.dart';

@freezed
@Collection(name: 'products')
abstract class Product with _$Product {
  const factory Product({
    required Id dbId,
    @Index(unique: true) required String sku,
    @Index() required String name,
    @Default(true) bool active,
  }) = _Product;
}
Cindel annotations such as @Index, @Enumerated, and @ignore can be placed on factory parameters in primary-factory models. Freezed union and sealed multi-constructor models are not supported.

Platform Support

cindel_flutter_libs provides prebuilt runtime assets for every platform that Cindel currently supports. No manual native toolchain setup is required for Flutter apps that depend on the package.
PlatformRuntime assetNotes
Android arm64-v8alibcindel_native.soBundled in jniLibs by cindel_flutter_libs
Android armeabi-v7alibcindel_native.soBundled in jniLibs by cindel_flutter_libs
Android x86_64libcindel_native.soBundled in jniLibs by cindel_flutter_libs
iOScindel.xcframeworkVendored xcframework; requires Xcode build on macOS
macOSlibcindel_native.dylibVendored dylib; requires Xcode build on macOS
Windowscindel_native.dllPrebuilt; bundled by cindel_flutter_libs
Linuxlibcindel_native.soPrebuilt; bundled by cindel_flutter_libs
Webcindel_worker.js, cindel_native.js, cindel_native_bg.wasmSQLite/OPFS Worker+Wasm; bundled by cindel_flutter_libs
Keep cindel and cindel_flutter_libs on exactly the same version in pubspec.yaml. The Dart runtime expects a native ABI that matches the version of cindel installed, and mismatched versions will fail at startup.
MDBX is the default storage backend on all native platforms. The Web backend uses SQLite/OPFS exclusively — MDBX does not run in the browser. Web support is experimental and should be validated in your target browser before shipping to production. Multi-tab coordination is not part of the current Web preview; only single-tab behavior is supported.

Build docs developers (and LLMs) love