Skip to content

Commit 7c77ca6

Browse files
committed
fixup! add temporary workaround for Dart SDK 2.12 deprecation of empty FFI structs
1 parent 1409ec5 commit 7c77ca6

File tree

3 files changed

+26
-27
lines changed

3 files changed

+26
-27
lines changed

objectbox/lib/src/bindings/objectbox-c.dart

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// ignore_for_file: non_constant_identifier_names
2-
// ignore_for_file: unused_field // TEMPORARY, see related commit message
32

43
// AUTO GENERATED FILE, DO NOT EDIT.
54
//
@@ -5457,7 +5456,7 @@ abstract class OBXPropertyFlags {
54575456
/// /// obx_model_last_relation_id()
54585457
class OBX_model extends ffi.Struct {
54595458
@ffi.Int32()
5460-
int _dummy;
5459+
int dummy;
54615460
}
54625461

54635462
/// /// Store represents a single database.
@@ -5466,15 +5465,15 @@ class OBX_model extends ffi.Struct {
54665465
/// /// It's possible to have multiple stores open at once, there's no globally shared state.
54675466
class OBX_store extends ffi.Struct {
54685467
@ffi.Int32()
5469-
int _dummy;
5468+
int dummy;
54705469
}
54715470

54725471
/// /// Store options customize the behavior of ObjectBox before opening a store. Options can't be changed once the store is
54735472
/// /// open but of course you can close the store and open it again with the changed options.
54745473
/// /// Some of the notable options are obx_opt_directory() and obx_opt_max_db_size_in_kb().
54755474
class OBX_store_options extends ffi.Struct {
54765475
@ffi.Int32()
5477-
int _dummy;
5476+
int dummy;
54785477
}
54795478

54805479
abstract class OBXDebugFlags {
@@ -5595,13 +5594,13 @@ class OBX_float_array extends ffi.Struct {
55955594
/// /// usually worth learning transaction basics to make your app more consistent and efficient, especially for writes.
55965595
class OBX_txn extends ffi.Struct {
55975596
@ffi.Int32()
5598-
int _dummy;
5597+
int dummy;
55995598
}
56005599

56015600
/// /// Cursor provides fine-grained (lower level API) access to the stored objects. Check also the more convenient Box API.
56025601
class OBX_cursor extends ffi.Struct {
56035602
@ffi.Int32()
5604-
int _dummy;
5603+
int dummy;
56055604
}
56065605

56075606
abstract class OBXPutMode {
@@ -5623,20 +5622,20 @@ abstract class OBXPutMode {
56235622
/// /// logically belong together (or for better performance).
56245623
class OBX_box extends ffi.Struct {
56255624
@ffi.Int32()
5626-
int _dummy;
5625+
int dummy;
56275626
}
56285627

56295628
/// /// Created by obx_box_async, used for async operations like obx_async_put.
56305629
class OBX_async extends ffi.Struct {
56315630
@ffi.Int32()
5632-
int _dummy;
5631+
int dummy;
56335632
}
56345633

56355634
/// /// You use QueryBuilder to specify criteria and create a Query which actually executes the query and returns matching
56365635
/// /// objects.
56375636
class OBX_query_builder extends ffi.Struct {
56385637
@ffi.Int32()
5639-
int _dummy;
5638+
int dummy;
56405639
}
56415640

56425641
/// /// Not really an enum, but binary flags to use across languages
@@ -5665,25 +5664,25 @@ abstract class OBXOrderFlags {
56655664
/// /// you may want to create clonse using obx_query_clone().
56665665
class OBX_query extends ffi.Struct {
56675666
@ffi.Int32()
5668-
int _dummy;
5667+
int dummy;
56695668
}
56705669

56715670
/// /// PropertyQuery - getting a single property instead of whole objects. Also provides aggregation over properties.
56725671
class OBX_query_prop extends ffi.Struct {
56735672
@ffi.Int32()
5674-
int _dummy;
5673+
int dummy;
56755674
}
56765675

56775676
/// /// Observers are called back when data has changed in the database.
56785677
/// /// See obx_observe(), or obx_observe_single_type() to listen to a changes that affect a single entity type
56795678
class OBX_observer extends ffi.Struct {
56805679
@ffi.Int32()
5681-
int _dummy;
5680+
int dummy;
56825681
}
56835682

56845683
class OBX_sync extends ffi.Struct {
56855684
@ffi.Int32()
5686-
int _dummy;
5685+
int dummy;
56875686
}
56885687

56895688
abstract class OBXSyncCredentialsType {
@@ -5743,7 +5742,7 @@ class OBX_sync_change_array extends ffi.Struct {
57435742

57445743
class OBX_dart_sync_listener extends ffi.Struct {
57455744
@ffi.Int32()
5746-
int _dummy;
5745+
int dummy;
57475746
}
57485747

57495748
const int OBX_VERSION_MAJOR = 0;

objectbox/lib/src/bindings/objectbox-dart.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ OBX_observer* obx_dart_observe(OBX_store* store, int64_t native_port);
4444
OBX_observer* obx_dart_observe_single_type(OBX_store* store, obx_schema_id type_id, int64_t native_port);
4545

4646
// Note: use OBX_dart_sync_listener_close() to unassign the listener and free native resources
47-
struct OBX_dart_sync_listener { int _dummy; /* TEMPORARY - prevent Dart SDK 2.12 warning before fully migrating */ };
47+
struct OBX_dart_sync_listener { int dummy; /* TEMPORARY - prevent Dart SDK 2.12 warning before fully migrating */ };
4848
typedef struct OBX_dart_sync_listener OBX_dart_sync_listener;
4949

5050
/// @param listener may be NULL

objectbox/lib/src/bindings/objectbox.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ typedef enum {
340340
/// - define entity types using obx_model_entity() and obx_model_property()
341341
/// - Pass the last ever used IDs with obx_model_last_entity_id(), obx_model_last_index_id(),
342342
/// obx_model_last_relation_id()
343-
struct OBX_model { int _dummy; /* TEMPORARY - prevent Dart SDK 2.12 warning before fully migrating */ };
343+
struct OBX_model { int dummy; /* TEMPORARY - prevent Dart SDK 2.12 warning before fully migrating */ };
344344
typedef struct OBX_model OBX_model;
345345

346346
/// Create an (empty) data meta model which is to be consumed by obx_opt_model().
@@ -428,13 +428,13 @@ obx_err obx_model_entity_last_property_id(OBX_model* model, obx_schema_id proper
428428
/// Once opened using obx_store_open(), it's an entry point to data access APIs such as box, query, cursor, transaction.
429429
/// After your work is done, you must close obx_store_close() to safely release all the handles and avoid data loss.
430430
/// It's possible to have multiple stores open at once, there's no globally shared state.
431-
struct OBX_store { int _dummy; /* TEMPORARY - prevent Dart SDK 2.12 warning before fully migrating */ };
431+
struct OBX_store { int dummy; /* TEMPORARY - prevent Dart SDK 2.12 warning before fully migrating */ };
432432
typedef struct OBX_store OBX_store;
433433

434434
/// Store options customize the behavior of ObjectBox before opening a store. Options can't be changed once the store is
435435
/// open but of course you can close the store and open it again with the changed options.
436436
/// Some of the notable options are obx_opt_directory() and obx_opt_max_db_size_in_kb().
437-
struct OBX_store_options { int _dummy; /* TEMPORARY - prevent Dart SDK 2.12 warning before fully migrating */ };
437+
struct OBX_store_options { int dummy; /* TEMPORARY - prevent Dart SDK 2.12 warning before fully migrating */ };
438438
typedef struct OBX_store_options OBX_store_options;
439439

440440
typedef enum {
@@ -715,7 +715,7 @@ obx_err obx_store_close(OBX_store* store);
715715
/// is done under the hood and transparent to you.
716716
/// However, there are situations where an explicit read transaction is necessary, e.g. obx_box_get(). Also, it’s
717717
/// usually worth learning transaction basics to make your app more consistent and efficient, especially for writes.
718-
struct OBX_txn { int _dummy; /* TEMPORARY - prevent Dart SDK 2.12 warning before fully migrating */ };
718+
struct OBX_txn { int dummy; /* TEMPORARY - prevent Dart SDK 2.12 warning before fully migrating */ };
719719
typedef struct OBX_txn OBX_txn;
720720

721721
/// Create a write transaction (read and write).
@@ -759,7 +759,7 @@ obx_err obx_txn_mark_success(OBX_txn* txn, bool wasSuccessful);
759759
//------------------------------------------------------------------
760760

761761
/// Cursor provides fine-grained (lower level API) access to the stored objects. Check also the more convenient Box API.
762-
struct OBX_cursor { int _dummy; /* TEMPORARY - prevent Dart SDK 2.12 warning before fully migrating */ };
762+
struct OBX_cursor { int dummy; /* TEMPORARY - prevent Dart SDK 2.12 warning before fully migrating */ };
763763
typedef struct OBX_cursor OBX_cursor;
764764

765765
typedef enum {
@@ -905,7 +905,7 @@ obx_err obx_cursor_ts_min_max_range(OBX_cursor* cursor, int64_t range_begin, int
905905
/// And because transactions offered by this C API are always reentrant, you can set your own transaction boundary
906906
/// using obx_txn_read() or obx_txn_write(). This is very much encouraged for calling multiple write operations that
907907
/// logically belong together (or for better performance).
908-
struct OBX_box { int _dummy; /* TEMPORARY - prevent Dart SDK 2.12 warning before fully migrating */ };
908+
struct OBX_box { int dummy; /* TEMPORARY - prevent Dart SDK 2.12 warning before fully migrating */ };
909909
typedef struct OBX_box OBX_box;
910910

911911
/// Get access to the box for the given entity. A box may be used across threads.
@@ -1100,7 +1100,7 @@ obx_err obx_box_ts_min_max_range(OBX_box* box, int64_t range_begin, int64_t rang
11001100
//----------------------------------------------
11011101

11021102
/// Created by obx_box_async, used for async operations like obx_async_put.
1103-
struct OBX_async { int _dummy; /* TEMPORARY - prevent Dart SDK 2.12 warning before fully migrating */ };
1103+
struct OBX_async { int dummy; /* TEMPORARY - prevent Dart SDK 2.12 warning before fully migrating */ };
11041104
typedef struct OBX_async OBX_async;
11051105

11061106
/// Note: DO NOT close this OBX_async; its lifetime is tied to the OBX_box instance.
@@ -1145,7 +1145,7 @@ obx_err obx_async_close(OBX_async* async);
11451145

11461146
/// You use QueryBuilder to specify criteria and create a Query which actually executes the query and returns matching
11471147
/// objects.
1148-
struct OBX_query_builder { int _dummy; /* TEMPORARY - prevent Dart SDK 2.12 warning before fully migrating */ };
1148+
struct OBX_query_builder { int dummy; /* TEMPORARY - prevent Dart SDK 2.12 warning before fully migrating */ };
11491149
typedef struct OBX_query_builder OBX_query_builder;
11501150

11511151
/// Not really an enum, but binary flags to use across languages
@@ -1350,7 +1350,7 @@ OBX_query_builder* obx_qb_link_time(OBX_query_builder* builder, obx_schema_id li
13501350
/// any number of times. It also supports parametrization before executing, further improving the reusability.
13511351
/// Query is NOT thread safe and must only be used from a single thread at the same time. If you prefer to avoid locks,
13521352
/// you may want to create clonse using obx_query_clone().
1353-
struct OBX_query { int _dummy; /* TEMPORARY - prevent Dart SDK 2.12 warning before fully migrating */ };
1353+
struct OBX_query { int dummy; /* TEMPORARY - prevent Dart SDK 2.12 warning before fully migrating */ };
13541354
typedef struct OBX_query OBX_query;
13551355

13561356
/// @returns NULL if the operation failed, see functions like obx_last_error_code() to get error details
@@ -1467,7 +1467,7 @@ size_t obx_query_param_alias_get_type_size(OBX_query* query, const char* alias);
14671467
//----------------------------------------------
14681468

14691469
/// PropertyQuery - getting a single property instead of whole objects. Also provides aggregation over properties.
1470-
struct OBX_query_prop { int _dummy; /* TEMPORARY - prevent Dart SDK 2.12 warning before fully migrating */ };
1470+
struct OBX_query_prop { int dummy; /* TEMPORARY - prevent Dart SDK 2.12 warning before fully migrating */ };
14711471
typedef struct OBX_query_prop OBX_query_prop;
14721472

14731473
/// Create a "property query" with results referring to single property (not complete objects).
@@ -1598,7 +1598,7 @@ OBX_float_array* obx_query_prop_find_floats(OBX_query_prop* query, const float*
15981598

15991599
/// Observers are called back when data has changed in the database.
16001600
/// See obx_observe(), or obx_observe_single_type() to listen to a changes that affect a single entity type
1601-
struct OBX_observer { int _dummy; /* TEMPORARY - prevent Dart SDK 2.12 warning before fully migrating */ };
1601+
struct OBX_observer { int dummy; /* TEMPORARY - prevent Dart SDK 2.12 warning before fully migrating */ };
16021602
typedef struct OBX_observer OBX_observer;
16031603

16041604
/// Callback for obx_observe()
@@ -1705,7 +1705,7 @@ void obx_posix_sem_prefix_set(const char* prefix);
17051705
/// @deprecated use obx_has_feature(OBXFeature_Sync)
17061706
bool obx_sync_available();
17071707

1708-
struct OBX_sync { int _dummy; /* TEMPORARY - prevent Dart SDK 2.12 warning before fully migrating */ };
1708+
struct OBX_sync { int dummy; /* TEMPORARY - prevent Dart SDK 2.12 warning before fully migrating */ };
17091709
typedef struct OBX_sync OBX_sync;
17101710

17111711
typedef enum {

0 commit comments

Comments
 (0)