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.shThis project is set up to run a pipeline in GitLab CI and two workflows on GitHub CI.
GitLab CI (see .gitlab-ci.yml) runs checks and tests for packages that use only the Dart SDK. Also, tests are only run on Linux.
GitHub CI (see test and code analysis workflows) also runs checks and tests that require a Flutter SDK. Tests are run on all supported platforms (macOS, Linux, Windows). Also, the main examples are verified to build for all supported platforms (including Android and iOS), indirectly verifying the generator works on all platforms.
In general, CI runs code analysis and format checks, tests the generator, runs unit tests and computes test code coverage.
For notes about updating the tested Dart and Flutter SDK versions, see the related dev doc. For the actually tested versions, see the CI config files linked above.
- 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