ObjectBox is a high-performance NoSQL database for Dart and Flutter with on-device vector search support. This ObjectBox Dart SDK uses FFI bindings to a native C library.
This is a multi-package monorepo:
-
objectbox/– Core runtime package (objectboxon pub.dev)lib/src/native/– FFI bindings and native implementations (Store, Box, Query, Sync)lib/src/native/bindings/– Auto-generated C bindings viaffigenlib/src/modelinfo/– Model metadata for generator and runtimelib/src/relations/– ToOne/ToMany relation implementationslib/src/annotations.dart– Entity annotations (@Entity,@Id,@Property, etc.)
-
generator/– Code generator package (objectbox_generatoron pub.dev)- Uses
build_runnerto generateobjectbox.g.dartfrom annotated entities lib/src/entity_resolver.dart– Parses entity classeslib/src/code_chunks.dart– Generates binding code
- Uses
-
objectbox_test/– Internal test package (not published)- Comprehensive tests for Box, Query, relations, Sync, observers, isolates
-
flutter_libs/– Flutter plugin bundling native libraries for all platforms -
sync_flutter_libs/– Flutter plugin with ObjectBox Sync support -
benchmark/– Performance benchmarks -
tool/– Shell scripts for versioning, publishing, and C library updates -
dev-doc/– Internal developer documentation
./tool/init.shThis initializes the workspace, downloads native libraries, and generates code.
To download the native library for a specific package:
./install.sh # Standard library
./install.sh --sync # Sync-enabled library- Always run
dart formaton changed files before committing - CI checks formatting with
dart format --set-exit-if-changed - Use
dart analyzeto check for issues
Tests are in objectbox_test/. Run with:
cd objectbox_test
dart pub get
dart run build_runner build
dart testGenerator integration tests:
./generator/test.shGitLab CI (.gitlab-ci.yml) runs:
- format-and-analyze – Formatting and static analysis
- generator-integ-tests – Generator integration tests
- unit-tests – Generator and objectbox unit tests (on lowest and latest Dart SDK)
- test-coverage – Coverage report generation
Tested Dart versions:
- Latest: 3.10.4
- Lowest supported: 3.7.3
- FFI bindings: ObjectBox uses Dart FFI to call the ObjectBox C API
- FlatBuffers: Objects are serialized using FlatBuffers internally
- Code generation:
build_runnergenerates entity bindings at compile time - Sync: Optional data synchronization feature (requires sync-enabled native library)
- Include tests for changes (see
objectbox_test/for examples) - Run
dart formaton modified files - Update
CHANGELOG.mdunder the## latestsection if the change affects users - Run
dart analyzeto check for issues
All packages share the same version. Use:
./tool/set-version.sh <version>See dev-doc/updating-c-library.md. Key steps:
- Update headers in
objectbox/lib/src/native/bindings/ - Run
dart run ffigeninobjectbox/ - Update version in
objectbox/lib/src/native/bindings/bindings.dart