File tree Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -107,7 +107,8 @@ class OBXFlatbuffersManager<T> {
107107 });
108108
109109 var endOffset = builder.endTable ();
110- return OBX_bytes_wrapper .managedCopyOf (builder.finish (endOffset));
110+ return OBX_bytes_wrapper .managedCopyOf (builder.finish (endOffset),
111+ align: true );
111112 }
112113
113114 T unmarshal (Pointer <Uint8 > dataPtr, int length) {
Original file line number Diff line number Diff line change @@ -49,12 +49,11 @@ class OBX_bytes_wrapper {
4949
5050 /// Returns a pointer to OBX_bytes with copy of the passed data.
5151 /// Warning: this creates two unmanaged pointers which must be freed manually: OBX_bytes.freeManaged(result).
52- OBX_bytes_wrapper .managedCopyOf (Uint8List data)
52+ /// ObjectBox requires object data to be aligned to the length of 4.
53+ OBX_bytes_wrapper .managedCopyOf (Uint8List data, {/*required*/ bool align})
5354 : _cBytes = allocate <OBX_bytes >() {
5455 final bytes = _cBytes.ref;
5556
56- // ObjectBox requires data to be aligned to the length of 4
57- const align = true ;
5857 bytes.size = align ? ((data.length + 3.0 ) ~ / 4.0 ) * 4 : data.length;
5958
6059 // NOTE: currently there's no way to get access to the underlying memory of Uint8List to avoid a copy.
Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ class SyncClient {
135135 /// Configure authentication credentials.
136136 /// The accepted [SyncCredentials] type depends on your sync-server configuration.
137137 void setCredentials (SyncCredentials creds) {
138- final cCreds = OBX_bytes_wrapper .managedCopyOf (creds._data);
138+ final cCreds = OBX_bytes_wrapper .managedCopyOf (creds._data, align : false );
139139 try {
140140 checkObx (bindings.obx_sync_credentials (
141141 ptr,
You can’t perform that action at this time.
0 commit comments