Flutter database for super-fast Dart object persistence
SyncCredentials.userAndPassword()
.SyncCredentials
from constructors to static methods. This should not require any changesNote: this release includes the same versions of the Android library and ObjectBox pod as release 2.5.0. See update instructions there.
Support creating file-less in-memory databases, for example for caching or testing. To create one
pass an in-memory identifier together with Store.inMemoryPrefix
as the directory
:
final inMemoryStore =
Store(getObjectBoxModel(), directory: "${Store.inMemoryPrefix}test-db");
See the Store
documentation for details.
Add Store.removeDbFiles()
to conveniently delete database files or an in-memory database.
Add Store.dbFileSize()
to get the size in bytes of the main database file or memory occupied by
an in-memory database.
Add relationCount()
query condition to match objects that have a certain number of related
objects pointing to them. E.g. Customer_.orders.relationCount(2)
will match all customers with
two orders. Customer_.orders.relationCount(0)
will match all customers with no associated order.
This can be useful to find objects where the relation was dissolved, e.g. after the related object
was removed.
Support for setting a maximum data size via the maxDataSizeInKB
property when building a Store
.
This is different from the existing maxDBSizeInKB
property in that it is possible to remove data
after reaching the limit and continue to use the database. See the Store
documentation for more
details.
For DateTime
properties new convenience query conditions are generated that accept DateTime
and auto-convert to milliseconds (or nanoseconds for @Property(type: PropertyType.dateNano)
) #287
// For example instead of:
Order_.date.between(DateTime(2024, 1).millisecondsSinceEpoch, DateTime(2024, 2).millisecondsSinceEpoch)
// You can now just write:
Order_.date.betweenMilliseconds(DateTime(2024, 1), DateTime(2024, 2))
When defining a property with a getter and setter instead of a field, support annotating the getter to configure or ignore the property #392
For example, it is now possible to do this:
@Property(type: PropertyType.date)
@Index()
DateTime get date => TODO;
set date(DateTime value) => TODO;
@Transient()
int get computedValue => TODO;
set computedValue(int value) => TODO;
For Flutter apps: loadObjectBoxLibraryAndroidCompat()
is now called by default when using
openStore()
(effective after re-running flutter pub run build_runner build
). For devices
running Android 6 or older this will pre-load the ObjectBox library in Java to prevent errors when
loading it in Dart.
If your code was calling the compat method manually, remove the call and re-run above command.
Let us know if there are issues with this change in #369!
Avoid conflicts with entity class names in generated code #519
Flutter for Linux/Windows, Dart Native: update to objectbox-c 0.21.0.
Flutter for Android: update to objectbox-android 3.8.0.
If you are using Admin, make sure to
update to io.objectbox:objectbox-android-objectbrowser:3.8.0
in android/app/build.gradle
.
Flutter for iOS/macOS: update to objectbox-swift 1.9.2.
Existing projects may have to run pod repo update
and pod update ObjectBox
.
Fix crash in Flutter plugin when running in debug mode on iOS. #561
Support Flutter projects using Android Gradle Plugin 8. #581
Flutter for Linux/Windows: fix CMake build deprecation warning. #522
Flutter for Linux/Windows, Dart Native: update to objectbox-c 0.20.0.
Flutter for Android: update to objectbox-android 3.7.1.
If you are using Admin, make sure to update to io.objectbox:objectbox-android-objectbrowser:3.7.1
in android/app/build.gradle
.
Notably requires Android 4.4 (API level 19) or higher.
Flutter for iOS/macOS: update to objectbox-swift 1.9.1.
Existing projects may have to run pod repo update
and pod update ObjectBox
.
Notably requires iOS 12.0 and macOS 10.15 or higher.
Sync: add Sync.clientMultiUrls
to work with multiple servers.
In this release objectbox_flutter_libs
and objectbox_sync_flutter_libs
continue to use objectbox-android 3.7.0
and Pod ObjectBox 1.9.0
.
Query support for integer and floating point lists: For integer lists (excluding byte lists) greater, less and equal are supported on elements of the vector (e.g. "has element greater").
For floating point lists greater and less queries are supported on elements of the vector (e.g. "has element greater").
A simple example is a shape entity that stores a palette of RGB colors:
@Entity()
class Shape {
@Id()
int id = 0;
// An array of RGB color values that are used by this shape.
Int32List? palette;
}
// Find all shapes that use red in their palette
final query = store.box<Shape>()
.query(Shape_.palette.equals(0xFF0000))
.build();
query.findIds();
query.close();
Queries: all expected results are now returned when using a less-than or less-or-equal condition
for a String property with IndexType.value
. #318
Queries: when combining multiple conditions with OR and adding a condition on a related entity ("link condition") the combined conditions are now properly applied. #546
Update: objectbox-c 0.19.0. Notably now requires glibc 2.28 or higher (and GLIBCXX_3.4.25); e.g. at least Debian Buster 10 (2019) or Ubuntu 20.04.
Update: objectbox-swift 1.9.0. Existing projects may have to run pod repo update
and pod update ObjectBox
.
Update: objectbox-android 3.7.0.
If you are using Admin, make sure to update to
io.objectbox:objectbox-android-objectbrowser:3.7.0
.
In this release objectbox_flutter_libs
ships with objectbox-android 3.5.1
and ObjectBox pod 1.8.1
.
For Flutter apps running on Android 6 (or older): added loadObjectBoxLibraryAndroidCompat()
to
objectbox_flutter_libs
(and objectbox_sync_flutter_libs
). Use this to fix loading the
ObjectBox library on these devices.
Let us know if this works for you in #369! We might consider calling this automatically in a future release.
Improve code generator performance if there are many entities with many constructor parameters.
Throw StateError
instead of crashing on closed Box
, Query
and PropertyQuery
.
Export query property classes to make them usable in user code.
Resolve an issue where unexpected data was returned when doing a read operation in an entity constructor or property setter. #550
In this release objectbox_flutter_libs
ships with objectbox-android 3.5.1
and ObjectBox pod 1.8.1
.
Support for integer and floating point lists: store 8-bit, 16-bit, 32-bit and 64-bit integer lists as well as 32-bit and 64-bit floating point lists (called "vectors" by ObjectBox).
Use a typed_data
class like Int16List
, Uint16List
or Float32List
for large lists, it uses
less memory and CPU. Otherwise just use a Dart number list.
A simple example is a shape entity that stores a palette of RGB colors:
@Entity()
class Shape {
@Id()
int id = 0;
// An array of RGB color values that are used by this shape.
Int32List? palette;
}
This can also be useful to store vector embeddings produced by machine learning:
@Entity()
class ImageEmbedding {
@Id()
int id = 0;
// Link to the actual image, e.g. on Cloud storage
String? url;
// The coordinates computed for this image (vector embedding)
@Property(type: PropertyType.floatVector)
List<double>? coordinates;
}
Note: for queries currently only the isNull
and notNull
conditions are supported.
Changed PropertyType.char
from a 8-bit signed integer to a 16-bit unsigned integer to match the
ObjectBox database type.
Fix put returning an incorrect error message in a rare case.
Require at least Dart SDK 2.18 (shipped with Flutter 3.3.0).
Let Store.awaitQueueCompletion
actually wait on the async queue to become idle. It previously
behaved like Store.awaitQueueSubmitted
.
Fix analysis event send failure breaking the code generator. #542
In this release objectbox_flutter_libs
ships with objectbox-android 3.5.1
and ObjectBox pod 1.8.1
.
To upgrade to this major release run flutter pub upgrade objectbox --major-versions
(or for Dart Native apps dart pub upgrade objectbox --major-versions
).
flutter pub run build_runner build
(or dart run build_runner build
for Dart Native apps) after updating!Box
:
getAsync
, getManyAsync
, getAllAsync
,putAsync
and putManyAsync
which support objects with relations,putAsync
to putQueuedAwaitResult
,putAndGetAsync
and putAndGetManyAsync
which return a copy of the given objects with new
IDs set.removeAsync
, removeManyAsync
and removeAllAsync
.Query
APIs: findAsync
, findFirstAsync
, findUniqueAsync
, findIdsAsync
and
removeAsync
.ToOne
and ToMany
across isolates, e.g. when using
store.runInTransactionAsync
. #340Store.attach
(and Store.fromReference
) do not longer accept a null model, which was not
supported anyhow.store.awaitAsyncSubmitted
and awaitAsyncCompletion
to
awaitQueueSubmitted
and awaitQueueCompletion
to avoid any mix-up with the new async methods.Store.runIsolated
.In this release objectbox_flutter_libs
ships with objectbox-android 3.5.1
and ObjectBox pod 1.8.1
.
objectbox-android-objectbrowser
dependency to 3.5.1
.We're hiring! 😎 We believe resource-efficient coding is still cool and are looking for a C / C++ developer who shares our sentiment.