objectbox-dart

Flutter database for super-fast Dart object persistence

APACHE-2.0 License

Stars
1K

Bot releases are visible (Hide)

objectbox-dart - Latest Release

Published by greenrobot-team 2 months ago

Note: this release includes the same versions of the Android library and ObjectBox pod as release 4.0.0.
See update instructions there.

objectbox-dart -

Published by greenrobot-team 5 months ago

  • Export ObjectWithScore and IdWithScore used by the new find with score Query methods. #637
  • Add simple vectorsearch_cities Dart Native example application.

Note: this release includes the same versions of the Android library and ObjectBox pod as release 4.0.0.
See update instructions there.

objectbox-dart - V4.0 Vector Search

Published by greenrobot-team 5 months ago

To upgrade to this major release run flutter pub upgrade objectbox --major-versions
(or for Dart Native apps dart pub upgrade objectbox --major-versions).

ObjectBox now supports Vector Search to enable efficient similarity searches.

This is particularly useful for AI/ML/RAG applications, e.g. image, audio, or text similarity. Other use cases include semantic search or recommendation engines.

Create a Vector (HNSW) index for a floating point vector property. For example, a City with a location vector:

@Entity()
class City {

  @HnswIndex(dimensions: 2)
  @Property(type: PropertyType.floatVector)
  List<double>? location;

}

Perform a nearest neighbor search using the new nearestNeighborsF32(queryVector, maxResultCount)
query condition and the new "find with scores" query methods (the score is the distance to the
query vector). For example, find the 2 closest cities:

final madrid = [40.416775, -3.703790];
final query = box
    .query(City_.location.nearestNeighborsF32(madrid, 2))
    .build();
final closest = query.findWithScores()[0].object;

For an introduction to Vector Search, more details and other supported languages see the
Vector Search documentation.

  • The generator correctly errors when using an unsupported index on a vector type.
  • Flutter for Linux/Windows, Dart Native: update to objectbox-c 4.0.0.
  • Flutter for Android: update to objectbox-android 4.0.0.
    If you are using Admin, make sure to
    update to io.objectbox:objectbox-android-objectbrowser:4.0.0 in android/app/build.gradle.
  • Flutter for iOS/macOS: update to objectbox-swift 2.0.0.
    Existing projects may have to run pod repo update and pod update ObjectBox.
objectbox-dart -

Published by greenrobot-team 8 months ago

  • Add SyncCredentials.userAndPassword().
  • Change SyncCredentials from constructors to static methods. This should not require any changes

Note: this release includes the same versions of the Android library and ObjectBox pod as release 2.5.0. See update instructions there.

objectbox-dart -

Published by greenrobot-team 8 months ago

  • 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.

objectbox-dart -

Published by greenrobot-team 10 months ago

  • 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.

objectbox-dart -

Published by greenrobot-team about 1 year ago

  • Fix "Loaded ObjectBox core dynamic library has unsupported version 0.18.1" on Android. #563
  • Support downloading 64-bit ARM library when building a Flutter app on Linux. Let us know if this works as expected in #564

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.

objectbox-dart -

Published by greenrobot-team about 1 year ago

  • 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.

  • Update: objectbox-android 3.7.0.
    If you are using Admin, make sure to update to
    io.objectbox:objectbox-android-objectbrowser:3.7.0.

objectbox-dart -

Published by greenrobot-team about 1 year ago

  • Resolve an issue where not all query results are returned, when an entity constructor or property
    setter itself executes a query. #550

In this release objectbox_flutter_libs ships with objectbox-android 3.5.1 and ObjectBox pod 1.8.1.

objectbox-dart -

Published by greenrobot-team about 1 year ago

  • 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.

objectbox-dart -

Published by greenrobot-team over 1 year ago

  • 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.

objectbox-dart -

Published by greenrobot-team over 1 year ago

To upgrade to this major release run flutter pub upgrade objectbox --major-versions
(or for Dart Native apps dart pub upgrade objectbox --major-versions).

  • Breaking changes to generated code: run flutter pub run build_runner build
    (or dart run build_runner build for Dart Native apps) after updating!
  • Added and updated async APIs in Box:
    • new getAsync, getManyAsync, getAllAsync,
    • new putAsync and putManyAsync which support objects with relations,
    • renamed the former putAsync to putQueuedAwaitResult,
    • new putAndGetAsync and putAndGetManyAsync which return a copy of the given objects with new
      IDs set.
    • new removeAsync, removeManyAsync and removeAllAsync.
  • Add new async Query APIs: findAsync, findFirstAsync, findUniqueAsync, findIdsAsync and
    removeAsync.
  • Support sending objects containing ToOne and ToMany across isolates, e.g. when using
    store.runInTransactionAsync. #340
  • Store.attach (and Store.fromReference) do not longer accept a null model, which was not
    supported anyhow.
  • Breaking change: renamed store.awaitAsyncSubmitted and awaitAsyncCompletion to
    awaitQueueSubmitted and awaitQueueCompletion to avoid any mix-up with the new async methods.
  • Removed deprecated Store.runIsolated.
  • Require at least Dart SDK 2.15 (shipped with Flutter 2.8.0).

In this release objectbox_flutter_libs ships with objectbox-android 3.5.1 and ObjectBox pod 1.8.1.

objectbox-dart -

Published by greenrobot-team over 1 year ago

We're hiring! 😎 We believe resource-efficient coding is still cool and are looking for a C / C++ developer who shares our sentiment.

objectbox-dart - v1.7.0

Published by greenrobot-team almost 2 years ago

  • Support more concise method chaining when using a sort order with a query:
    // BEFORE
    final query = (box.query()..order(Person_.name)).build();
    // AFTER
    final query = box.query().order(Person_.name).build();
    
  • Allow analyzer with major version 5. #487
  • Generator not longer warns that it can not find the package source root if the output directory is
    the package root directory.
  • Query: add .containsElement, deprecate .contains condition for List<String>. #481
  • Add StorageException which is a ObjectBoxException with an errorCode (a OBX_ERROR code).
  • Throw DbFullException instead of ObjectBoxException with message 10101 Could not put (error
    code OBX_ERROR_DB_FULL).
  • Change Query.findUnique() to throw NonUniqueResultException instead of
    UniqueViolationException if there is more than one result.
  • Update: objectbox-c 0.18.0.
  • Update: objectbox-android 3.5.0. If you are using Admin, make sure to update your objectbox-android-objectbrowser dependency.
  • Update: objectbox-swift 1.8.1-rc.
  • (Data) Sync only: protocol updates improving efficiency. Reach out via your existing contact to check if any actions are required for your setup.
objectbox-dart -

Published by greenrobot-team about 2 years ago

  • Revert to objectbox-android 3.2.0 to restore query functionality (#460). If you are using Admin, make sure to update your objectbox-android-objectbrowser dependency.
  • Generator messages should be more helpful, provide code location when possible and link to docs.
objectbox-dart -

Published by greenrobot-team about 2 years ago

  • Store: add option to pass debug flags. #134
  • Add // coverage:ignore-file to generated objectbox.g.dart skipping this file from coverage test.
  • Increase supported analyzer to v4. #443
  • Update documentation on Query streams using watch to highlight it is a single-subscription
    stream that can only be listened to once. Also updated code examples to not imply the stream is
    re-usable.
  • Update: objectbox-android 3.2.1.
objectbox-dart -

Published by greenrobot-team over 2 years ago

  • Require at least Dart SDK 2.14 (shipped with Flutter 2.5.0).
  • When using the "All Exceptions" debug option in Visual Studio Code there is no longer an exception
    when initializing ObjectBox. #252
  • Update: objectbox-c 0.17.0.
  • Update: objectbox-android 3.2.0.
objectbox-dart -

Published by greenrobot-team over 2 years ago

  • Add Store.runInTransactionAsync to run database operations asynchronously in the background (requires Flutter 2.8.0/Dart 2.15.0 or newer). #415
  • Rename Store.runIsolated to runAsync, drop unused mode parameter, propagate errors and handle premature isolate exit. #415
  • The native ObjectBox library is also searched for in the lib subfolder on desktop OS (macOS, Linux, Windows). This is where the install.sh script downloads it by default.
    E.g. it is no longer necessary to install the library globally to run dart test or flutter test.
  • Windows: Support database directory paths that contain unicode (UTF-8) characters. #406
  • Changed Query.stream to collect results in a worker isolate, which should typically be faster. #420
  • Update: objectbox-c 0.16.0.
  • Update: objectbox-android 3.1.3.
  • Add new task with tag list Flutter example app that shows how to use relations. #419
objectbox-dart -

Published by greenrobot-team over 2 years ago

  • Resolve "another store is still open" issue after Flutter hot restart (hot reload continues to work). #387
  • Add Store.isClosed(). #390
  • Add note to objectbox.g.dart on how to re-generate (update) it.
objectbox-dart -

Published by greenrobot-team over 2 years ago

Note: the code generated by ObjectBox has breaking changes, make sure to re-generate it after upgrading using
flutter pub run build_runner build (or dart run build_runner build for Dart only projects).

  • Support ObjectBox Admin for Android apps to browse the database. #148
  • Add Store.runIsolated to run database operations (asynchronous) in the background (requires Flutter 2.8.0/Dart 2.15.0 or newer). It spawns an isolate, runs the given callback in that isolate with its own Store and returns the result of the callback. This is similar to Flutters compute, but with the callback having access to a Store. #384
  • Add Store.attach to attach to a Store opened in a directory. This is an improved replacement for Store.fromReference to share a Store across isolates. It is no longer required to pass a Store reference and the underlying Store remains open until the last instance is closed. #376
  • Add an option to change code-generator's output_dir in pubspec.yaml. #341
  • Update: objectbox-c 0.15.2.
  • Update: objectbox-android 3.1.2.
  • Update: objectbox-swift 1.7.0.