Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ jobs:
../tool/pub.sh run test
- name: Install ObjectBox C library
working-directory: objectbox_test
run: ../install.sh
# Use Sync-enabled library to at least partially run sync_test.dart
run: ../install.sh --sync
- name: Library Test
working-directory: objectbox_test
# Set concurrency=1 to run only one test suite (== test file) at a time to make it easier to
Expand Down
3 changes: 2 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ generator-integ-tests:
- dart test --concurrency=1 --reporter expanded
# ObjectBox tests
- cd ../objectbox_test
- ../install.sh
# Use Sync-enabled library to at least partially run sync_test.dart
- ../install.sh --sync
- dart pub get
- dart run build_runner build
# Set concurrency=1 to run only one test suite (== test file) at a time.
Expand Down
28 changes: 14 additions & 14 deletions dev-doc/updating-c-library.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,37 +19,37 @@ for the binding update script (see below) and
for Flutter (`flutter_libs` and `sync_flutter_libs` plugins) on Linux and Windows:

```bash
./tool/set-c-version.sh 4.3.1
./tool/set-c-version.sh 5.0.0-rc
```

```text
* Update ObjectBox database for Flutter Linux/Windows, Dart Native apps to [4.3.1](https://github.com/objectbox/objectbox-c/releases/tag/v4.3.1).
* Update ObjectBox database for Flutter Linux/Windows, Dart Native apps to [5.0.0-rc](https://github.com/objectbox/objectbox-c/releases/tag/v5.0.0-rc).
```

```text
Update C library [4.3.0 -> 4.3.1]
Update C library [4.3.1 -> 5.0.0-rc]

Includes database 4.3.1-2025-07-28
Includes database 5.0.0-2025-09-27
```

### Android

For the Flutter plugins on Android ([view releases](https://github.com/objectbox/objectbox-java/releases)):

```bash
./tool/set-android-version.sh 4.3.1
./tool/set-android-version.sh 5.0.1
```

```text
* Update ObjectBox database for Flutter Android apps to 4.3.1.
* Update ObjectBox database for Flutter Android apps to 5.0.1.
If your project is [using Admin](https://docs.objectbox.io/data-browser#admin-for-android), make
sure to update to `io.objectbox:objectbox-android-objectbrowser:4.3.1` in `android/app/build.gradle`.
sure to update to `io.objectbox:objectbox-android-objectbrowser:5.0.1` in `android/app/build.gradle`.
```

```text
Update Android library [4.3.0 -> 4.3.1]
Update Android library [4.3.1 -> 5.0.1]

Includes C API 4.3.1 and database 4.3.1-2025-08-02
Includes C API 5.0.0 and database 5.0.0-2025-09-27
```

Note: the embedded C API and ObjectBox version can be looked up
Expand All @@ -60,18 +60,18 @@ from the relevant objectbox repository release tag (like `java-4.1.0`).
For the Flutter plugins on iOS/macOS ([view releases](https://github.com/objectbox/objectbox-swift/releases))

```bash
./tool/set-swift-version.sh 4.4.1
./tool/set-swift-version.sh 5.0.0
```

```text
* Update ObjectBox database for Flutter iOS/macOS apps to 4.3.1.
* Update ObjectBox database for Flutter iOS/macOS apps to 5.0.0.
For existing projects, run `pod repo update` and `pod update ObjectBox` in the `ios` or `macos` directories.
```

```text
Update macOS/iOS library [4.3.0 -> 4.4.1]
Update macOS/iOS library [4.4.1 -> 5.0.0]

Includes C API 4.3.1 and database 4.3.1-2025-08-02
Includes C API 5.0.0 and database 5.0.0-2025-09-27
```

Note: the embedded C API and ObjectBox version can be looked up
Expand All @@ -98,5 +98,5 @@ Then manually:
- Commit as

```text
Update C-API [4.3.0 -> 4.3.1]
Update C-API [4.3.1 -> 5.0.0]
```
2 changes: 1 addition & 1 deletion flutter_libs/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ android {
// ObjectBox Android library that includes an ObjectBox C library version compatible with
// the C API binding of the ObjectBox Dart package.
// https://central.sonatype.com/search?q=g:io.objectbox%20objectbox-android
implementation "io.objectbox:objectbox-android:4.3.1"
implementation "io.objectbox:objectbox-android:5.0.1"
}
}
2 changes: 1 addition & 1 deletion flutter_libs/ios/objectbox_flutter_libs.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Pod::Spec.new do |s|
s.source_files = 'Classes/**/*'

s.dependency 'Flutter'
s.dependency 'ObjectBox', '4.4.1'
s.dependency 'ObjectBox', '5.0.0'

# Flutter.framework does not contain a i386 slice.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
Expand Down
2 changes: 1 addition & 1 deletion flutter_libs/linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::GTK)
# ----------------------------------------------------------------------
# Download and add objectbox-c prebuilt library.

set(OBJECTBOX_VERSION 4.3.1)
set(OBJECTBOX_VERSION 5.0.0-rc)

set(OBJECTBOX_ARCH ${CMAKE_SYSTEM_PROCESSOR})
if (${OBJECTBOX_ARCH} MATCHES "x86_64")
Expand Down
2 changes: 1 addition & 1 deletion flutter_libs/macos/objectbox_flutter_libs.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Pod::Spec.new do |s|
s.source_files = 'Classes/**/*'

s.dependency 'FlutterMacOS'
s.dependency 'ObjectBox', '4.4.1'
s.dependency 'ObjectBox', '5.0.0'

s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
s.swift_version = '5.3'
Expand Down
2 changes: 1 addition & 1 deletion flutter_libs/windows/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ set(objectbox_flutter_libs_bundled_libraries
# ----------------------------------------------------------------------
# Download and add objectbox-c prebuilt library.

set(OBJECTBOX_VERSION 4.3.1)
set(OBJECTBOX_VERSION 5.0.0-rc)

set(OBJECTBOX_ARCH ${CMAKE_SYSTEM_PROCESSOR})
if (${OBJECTBOX_ARCH} MATCHES "AMD64")
Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -eu
# It's important that the generated dart bindings and the c-api library version match. Dart won't error on C function
# signature mismatch, leading to obscure memory bugs.
# For how to upgrade the version see dev-doc/updating-c-library.md
cLibVersion=4.3.1
cLibVersion=5.0.0-rc
os=$(uname)
cLibArgs="$*"

Expand Down
18 changes: 18 additions & 0 deletions objectbox/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
## latest

### Sync

- Support Sync server version 5.0.
- **User-Specific Data Sync**: support configuring [Sync filter](https://sync.objectbox.io/sync-server/sync-filters)
variables on `SyncClient`.

### Other Changes

* Flutter packages are compiled with Android SDK 35 to support Android Gradle Plugin 8.13
[#755](https://github.com/objectbox/objectbox-dart/issues/755). They are also built using a
language level of Java 11.
* Update ObjectBox database for Flutter Linux/Windows, Dart Native apps to [5.0.0-rc](https://github.com/objectbox/objectbox-c/releases/tag/v5.0.0-rc).
* ToOne relations: when deleting an object with an ID larger than the maximum 32-bit unsigned
integer (`4_294_967_295`) that is used as the target object of a ToOne, correctly re-set the
target ID of the ToOne to `0`. [#740](https://github.com/objectbox/objectbox-dart/issues/740)
* Update ObjectBox database for Flutter Android apps to 5.0.1.
If your project is [using Admin](https://docs.objectbox.io/data-browser#admin-for-android), make
sure to update to `io.objectbox:objectbox-android-objectbrowser:5.0.1` in `android/app/build.gradle`.
* Update ObjectBox database for Flutter iOS/macOS apps to 5.0.0.
For existing projects, run `pod repo update` and `pod update ObjectBox` in the `ios` or `macos` directories.
* Remove deprecated `contains` condition for `List<String>` properties, use `containsElement` instead.

## 4.3.1 (2025-09-02)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,5 @@ dependencies {
// Add the Android library with ObjectBox Admin only for debug builds.
// Note: when the objectbox package updates, check if the Android
// library below needs to be updated as well.
debugImplementation("io.objectbox:objectbox-android-objectbrowser:4.3.1")
debugImplementation("io.objectbox:objectbox-android-objectbrowser:5.0.1")
}
14 changes: 7 additions & 7 deletions objectbox/lib/src/native/bindings/bindings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ ObjectBoxC? _tryObjectBoxLibFile() {
// libraries.
// Library | C API | Database
// ------------------------|-------|-----------------
// C library 4.3.1 | 4.3.1 | 4.3.1-2025-07-28
// Android library 4.3.1 | 4.3.1 | 4.3.1-2025-08-02
// macOS/iOS library 4.4.1 | 4.3.1 | 4.3.1-2025-08-02
var _obxCminMajor = 4;
var _obxCminMinor = 3;
var _obxCminPatch = 1;
// C library 5.0.0-rc | 5.0.0 | 5.0.0-2025-09-27
// Android library 5.0.1 | 5.0.0 | 5.0.0-2025-09-27
// macOS/iOS library 5.0.0 | 5.0.0 | 5.0.0-2025-09-27
var _obxCminMajor = 5;
var _obxCminMinor = 0;
var _obxCminPatch = 0;
// Require minimum database version guaranteeing actual C API availability.
var _obxDatabaseMinVersion = "4.3.1-2025-07-28";
var _obxDatabaseMinVersion = "5.0.0-2025-09-27";

bool _isSupportedVersion(ObjectBoxC obxc) {
// Require a minimum C API version
Expand Down
16 changes: 15 additions & 1 deletion objectbox/lib/src/native/bindings/objectbox-sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include "objectbox.h"

#if defined(static_assert) || defined(__cplusplus)
static_assert(OBX_VERSION_MAJOR == 4 && OBX_VERSION_MINOR == 3 && OBX_VERSION_PATCH == 1, // NOLINT
static_assert(OBX_VERSION_MAJOR == 5 && OBX_VERSION_MINOR == 0 && OBX_VERSION_PATCH == 0, // NOLINT
"Versions of objectbox.h and objectbox-sync.h files do not match, please update");
#endif

Expand Down Expand Up @@ -201,6 +201,20 @@ OBX_C_API OBX_sync* obx_sync_urls(OBX_store* store, const char* server_urls[], s
/// Stops and closes (deletes) the sync client, freeing its resources.
OBX_C_API obx_err obx_sync_close(OBX_sync* sync);

/// Adds or replaces a sync filter variable value for the given name to the sync client.
/// Eventually existing values for the same name are replaced.
/// Client filter variables can be used in server-side sync filters to filter out objects that do not match the filter.
/// Filter variables must be added before login, e.g. before obx_sync_start() or setting credentials.
/// @param name non-NULL name of the filter variable
/// @param value non-NULL value of the filter variable
OBX_C_API obx_err obx_sync_filter_variables_put(OBX_sync* sync, const char* name, const char* value);

/// Removes a previously added sync filter variable value.
OBX_C_API obx_err obx_sync_filter_variables_remove(OBX_sync* sync, const char* name);

/// Removes all previously added sync filter variable values.
OBX_C_API obx_err obx_sync_filter_variables_remove_all(OBX_sync* sync);

/// Sets credentials to authenticate the client with the server.
/// Any credentials that were set before are replaced;
/// if you want to pass multiple credentials, use obx_sync_credentials_add() instead.
Expand Down
10 changes: 6 additions & 4 deletions objectbox/lib/src/native/bindings/objectbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ extern "C" {

/// When using ObjectBox as a dynamic library, you should verify that a compatible version was linked using
/// obx_version() or obx_version_is_at_least().
#define OBX_VERSION_MAJOR 4
#define OBX_VERSION_MINOR 3
#define OBX_VERSION_PATCH 1 // values >= 100 are reserved for dev releases leading to the next minor/major increase
#define OBX_VERSION_MAJOR 5
#define OBX_VERSION_MINOR 0
#define OBX_VERSION_PATCH 0 // values >= 100 are reserved for dev releases leading to the next minor/major increase

//----------------------------------------------
// Common types
Expand Down Expand Up @@ -179,6 +179,8 @@ typedef enum {
/// This is a free trial version; only applies to server builds (no trial builds for database and Sync clients).
OBXFeature_Trial = 18,

/// Server-side filters to return individual data for each sync user (user-specific data).
OBXFeature_SyncFilters = 19,

} OBXFeature;

Expand Down Expand Up @@ -2121,7 +2123,7 @@ OBX_C_API obx_qb_cond obx_qb_less_or_equal_string(OBX_query_builder* builder, ob
OBX_C_API obx_qb_cond obx_qb_in_strings(OBX_query_builder* builder, obx_schema_id property_id,
const char* const values[], size_t count, bool case_sensitive);

/// For OBXPropertyType_StringVector - matches if at least one vector item equals the given value.
/// @deprecated Please use obx_qb_contains_element_string() instead.
OBX_C_API obx_qb_cond obx_qb_any_equals_string(OBX_query_builder* builder, obx_schema_id property_id, const char* value,
bool case_sensitive);

Expand Down
72 changes: 68 additions & 4 deletions objectbox/lib/src/native/bindings/objectbox_c.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4935,7 +4935,7 @@ class ObjectBoxC {
int Function(ffi.Pointer<OBX_query_builder>, int,
ffi.Pointer<ffi.Pointer<ffi.Char>>, int, bool)>();

/// For OBXPropertyType_StringVector - matches if at least one vector item equals the given value.
/// @deprecated Please use obx_qb_contains_element_string() instead.
int qb_any_equals_string(
ffi.Pointer<OBX_query_builder> builder,
int property_id,
Expand Down Expand Up @@ -8399,6 +8399,67 @@ class ObjectBoxC {
late final _sync_close =
_sync_closePtr.asFunction<int Function(ffi.Pointer<OBX_sync>)>();

/// Adds or replaces a sync filter variable value for the given name to the sync client.
/// Eventually existing values for the same name are replaced.
/// Client filter variables can be used in server-side sync filters to filter out objects that do not match the filter.
/// Filter variables must be added before login, e.g. before obx_sync_start() or setting credentials.
/// @param name non-NULL name of the filter variable
/// @param value non-NULL value of the filter variable
int sync_filter_variables_put(
ffi.Pointer<OBX_sync> sync1,
ffi.Pointer<ffi.Char> name,
ffi.Pointer<ffi.Char> value,
) {
return _sync_filter_variables_put(
sync1,
name,
value,
);
}

late final _sync_filter_variables_putPtr = _lookup<
ffi.NativeFunction<
obx_err Function(ffi.Pointer<OBX_sync>, ffi.Pointer<ffi.Char>,
ffi.Pointer<ffi.Char>)>>('obx_sync_filter_variables_put');
late final _sync_filter_variables_put =
_sync_filter_variables_putPtr.asFunction<
int Function(ffi.Pointer<OBX_sync>, ffi.Pointer<ffi.Char>,
ffi.Pointer<ffi.Char>)>();

/// Removes a previously added sync filter variable value.
int sync_filter_variables_remove(
ffi.Pointer<OBX_sync> sync1,
ffi.Pointer<ffi.Char> name,
) {
return _sync_filter_variables_remove(
sync1,
name,
);
}

late final _sync_filter_variables_removePtr = _lookup<
ffi.NativeFunction<
obx_err Function(ffi.Pointer<OBX_sync>,
ffi.Pointer<ffi.Char>)>>('obx_sync_filter_variables_remove');
late final _sync_filter_variables_remove = _sync_filter_variables_removePtr
.asFunction<int Function(ffi.Pointer<OBX_sync>, ffi.Pointer<ffi.Char>)>();

/// Removes all previously added sync filter variable values.
int sync_filter_variables_remove_all(
ffi.Pointer<OBX_sync> sync1,
) {
return _sync_filter_variables_remove_all(
sync1,
);
}

late final _sync_filter_variables_remove_allPtr =
_lookup<ffi.NativeFunction<obx_err Function(ffi.Pointer<OBX_sync>)>>(
'obx_sync_filter_variables_remove_all');
late final _sync_filter_variables_remove_all =
_sync_filter_variables_remove_allPtr
.asFunction<int Function(ffi.Pointer<OBX_sync>)>();

/// Sets credentials to authenticate the client with the server.
/// Any credentials that were set before are replaced;
/// if you want to pass multiple credentials, use obx_sync_credentials_add() instead.
Expand Down Expand Up @@ -10400,6 +10461,9 @@ abstract class OBXFeature {

/// This is a free trial version; only applies to server builds (no trial builds for database and Sync clients).
static const int Trial = 18;

/// Server-side filters to return individual data for each sync user (user-specific data).
static const int SyncFilters = 19;
}

/// Log level as passed to obx_log_callback.
Expand Down Expand Up @@ -11677,11 +11741,11 @@ class OBX_dart_finalizer extends ffi.Opaque {}
typedef obx_dart_closer
= ffi.NativeFunction<obx_err Function(ffi.Pointer<ffi.Void> native_object)>;

const int OBX_VERSION_MAJOR = 4;
const int OBX_VERSION_MAJOR = 5;

const int OBX_VERSION_MINOR = 3;
const int OBX_VERSION_MINOR = 0;

const int OBX_VERSION_PATCH = 1;
const int OBX_VERSION_PATCH = 0;

const int OBX_ID_NEW = -1;

Expand Down
5 changes: 0 additions & 5 deletions objectbox/lib/src/native/query/query.dart
Original file line number Diff line number Diff line change
Expand Up @@ -433,11 +433,6 @@ class QueryStringVectorProperty<EntityT>
extends QueryProperty<EntityT, List<String>> {
QueryStringVectorProperty(super.model);

@Deprecated(
'Use `containsElement` instead. Will be removed in a future release.')
Condition<EntityT> contains(String p, {bool? caseSensitive, String? alias}) =>
containsElement(p, caseSensitive: caseSensitive, alias: alias);

/// Matches if at least one element of the list equals the given value.
Condition<EntityT> containsElement(String value,
{bool? caseSensitive, String? alias}) =>
Expand Down
Loading
Loading