You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, every time someone builds a Gradle project, the plugin will look for the entities and recreate the model JSON file if needed.
My suggestion is to add an option to only read the model file without checking and changing it.
The reason for such an option is to allow sharing the same model file and database in multiple languages.
To be more specific, I have a Flutter app that uses objectbox-dart, that app also has Android widgets written in Kotlin, so the idea is that I want to load an objectbox database in read-only mode inside my widget to get information previously added using objectbox-dart in Flutter.
I'm able to do that if I add this to my build.gradle file:
And that works, the issue is that from the Flutter side, I have multiple entities, but from the Kotlin side, I'm only interested in one, so if I build my grade project, my JSON model will be replaced with only the entity shared between both languages, to make the Flutter app work again, I need to always forcefully regenerate the model so it overrides what the gradle plugin changed. Hence why I want to prevent gradle build from changing that file.
The text was updated successfully, but these errors were encountered:
This is not as simple as adding a read-only flag as the plugin also generates code that depends on entity classes to exist. Technically it should be possible, as only the model (MyObjectBox) needs to be generated fully to be passed to the database on open. Other generated classes (EntityInfo_ and EntityCursor) could be skipped in such a mode.
Currently, every time someone builds a Gradle project, the plugin will look for the entities and recreate the model JSON file if needed.
My suggestion is to add an option to only read the model file without checking and changing it.
The reason for such an option is to allow sharing the same model file and database in multiple languages.
To be more specific, I have a Flutter app that uses objectbox-dart, that app also has Android widgets written in Kotlin, so the idea is that I want to load an objectbox database in read-only mode inside my widget to get information previously added using objectbox-dart in Flutter.
I'm able to do that if I add this to my
build.gradle
file:And that works, the issue is that from the Flutter side, I have multiple entities, but from the Kotlin side, I'm only interested in one, so if I build my grade project, my JSON model will be replaced with only the entity shared between both languages, to make the Flutter app work again, I need to always forcefully regenerate the model so it overrides what the gradle plugin changed. Hence why I want to prevent gradle build from changing that file.
The text was updated successfully, but these errors were encountered: