Skip to content

v2.5.0

Compare
Choose a tag to compare
@greenrobot-team greenrobot-team released this 14 Feb 14:09
· 135 commits to main since this release
  • 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.