diff --git a/dev-doc/updating-c-library.md b/dev-doc/updating-c-library.md index cba9b256e..bac3ccd4f 100644 --- a/dev-doc/updating-c-library.md +++ b/dev-doc/updating-c-library.md @@ -18,6 +18,9 @@ Update `flutter_libs` and `sync_flutter_libs` with **compatible library versions - Shortcut: search and replace `-android:3.1.3` in `build.gradle` files. - In [flutter_libs](../flutter_libs/android/build.gradle) - In [sync_flutter_libs](../sync_flutter_libs/android/build.gradle) +- Android in examples. + - Shortcut: search and replace `-android-objectbrowser:3.1.3` in `build.gradle` files. + - In [objectbox_demo_relations](../objectbox/example/flutter/objectbox_demo_relations/android/app/build.gradle) - Swift (iOS/macOS) ([view releases](https://github.com/objectbox/objectbox-swift/releases)) - Shortcut: search and replace e.g. `s.dependency 'ObjectBox', '1.7.0` in `.podspec` files. - In [flutter_libs for iOS](../flutter_libs/ios/objectbox_flutter_libs.podspec) diff --git a/objectbox/example/flutter/objectbox_demo_relations/README.md b/objectbox/example/flutter/objectbox_demo_relations/README.md index 905f41c30..b1ef239f1 100644 --- a/objectbox/example/flutter/objectbox_demo_relations/README.md +++ b/objectbox/example/flutter/objectbox_demo_relations/README.md @@ -9,7 +9,9 @@ See how to: - create Boxes and put Objects there ([objectbox.dart](lib/objectbox.dart)) - query for Objects ([objectbox.dart](lib/objectbox.dart)) - create, read, update and delete Objects ([main.dart](lib/main.dart)) +- add ObjectBox Admin for debug builds ([objectbox.dart](lib/objectbox.dart), [build.gradle](android/app/build.gradle)) ## Docs - [Getting started with ObjectBox](https://docs.objectbox.io/getting-started) - [How to use ObjectBox Relations](https://docs.objectbox.io/relations) +- [ObjectBox Admin](https://docs.objectbox.io/data-browser) diff --git a/objectbox/example/flutter/objectbox_demo_relations/android/app/build.gradle b/objectbox/example/flutter/objectbox_demo_relations/android/app/build.gradle index c74b2447c..e33df4e79 100644 --- a/objectbox/example/flutter/objectbox_demo_relations/android/app/build.gradle +++ b/objectbox/example/flutter/objectbox_demo_relations/android/app/build.gradle @@ -70,6 +70,21 @@ flutter { source '../..' } +// Optional: add ObjectBox Admin - https://docs.objectbox.io/data-browser +// Tell Gradle to exclude the objectbox-android dependency from debug builds +// that is added by objectbox_flutter_libs. Keeps it for release and profile builds. +configurations { + debugImplementation { + exclude group: 'io.objectbox', module: 'objectbox-android' + } +} + dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + + // Optional: add ObjectBox Admin - https://docs.objectbox.io/data-browser + // Add objectbox-android-objectbrowser only for debug builds. + // Warning: when objectbox_flutter_libs updates check if version + // needs update, e.g. check https://github.com/objectbox/objectbox-dart/releases. + debugImplementation("io.objectbox:objectbox-android-objectbrowser:3.1.3") } diff --git a/objectbox/example/flutter/objectbox_demo_relations/lib/objectbox.dart b/objectbox/example/flutter/objectbox_demo_relations/lib/objectbox.dart index 1f21dc9cf..409a44c3b 100644 --- a/objectbox/example/flutter/objectbox_demo_relations/lib/objectbox.dart +++ b/objectbox/example/flutter/objectbox_demo_relations/lib/objectbox.dart @@ -7,6 +7,7 @@ import 'objectbox.g.dart'; // created by `flutter pub run build_runner build` class ObjectBox { /// The Store of this app. late final Store store; + late final Admin _admin; /// Two Boxes: one for Tasks, one for Tags. late final Box taskBox; @@ -17,6 +18,13 @@ class ObjectBox { late final Stream> tagsStream; ObjectBox._create(this.store) { + // Optional: enable ObjectBox Admin on debug builds. + // https://docs.objectbox.io/data-browser + if (Admin.isAvailable()) { + // Keep a reference until no longer needed or manually closed. + _admin = Admin(store); + } + taskBox = Box(store); tagBox = Box(store);