realm-dart
realm-dart copied to clipboard
Support embedded objects
Is it planned at some point? Thanks
Hi Lukasz
Great to see you here.
Yes, we plan to support embedded objects. There are a number of major and minor features we are still missing.
- Embedded objects,
- Mixed,
- Sets,
- Maps,
- Upserts,
- Better client-reset handling,
- Async writes, and
- Asymmetric sync
comes to mind.
In general the Flutter / Dart SDK will support all features, supported by the other SDKs, unless the feature is considered deprecated.
However, we cannot give exact timelines for when each feature will land..
Br, Kasper
Sorry about that. Will close when Embedded objects land.
Thanks for the detailed answer. Understandable for not having a specific timeline. Looking forward to the next updates then!
Is there any sort of documented workaround for this gap at the moment? It basically means the SDK is not usable for my database schema at the moment.
There are no workarounds at this point.
I'm also waiting for "Embedded objects" to switch to Realm!
Afternoon, just wondering if there are any updates on embedded objects / arrays? Hope you are all well
As you know I'm really not allowed to give ETAs. I can say that we intend to make more incremental releases than we have in the past, and that embedded objects are high on our agenda.
In the meantime, consider if it is possible to either use full-blown realm objects, or serialise in-and-out of a String (fx.)
Thanks @nielsenko appreciate and appreciate your update!
This is done and will be released shortly
Hello everybody!
First, thanks for updating the lib with the specification of enbedded objects.
I would like your help regarding the use of the resource.
I'm trying to synchronize the schema, but it's generating an error when doing the process.
I have 2 separate classes to handle the data and the relationship with the embedded object, but when building the app, an error message is returned.
@RealmModel()
@MapTo('person')
class _Person {
late String name;
@MapTo('address')
_Address? personAddress;
}
// The generated `Address` class will be an embedded object.
@RealmModel(ObjectType.embeddedObject)
class _Address {
late String street;
late String city;
}
Part of the generated file:
// ...another properties
SchemaProperty('address', RealmPropertyType.object, mapTo: 'address', optional: true, linkTarget: 'Address'),
When I start the application, the message below is displayed:
RealmException (RealmException: Error opening realm at path /data/data/br.com.project/files/mongodb-realm/project/635ff39dfb368ea22639a5cb/default.realm. Error code: 18 . Message: Schema validation failed due to the following errors:
- Property 'person.address' of type 'object' has unknown object type 'Address'
I've run on several emulators (Ios and Android), devices (Asus, Iphone 12, Xiaomi), but in all of them the error is persisting.
Is there a process I'm missing?
Thanks!
Hi @ffelicioautodoc
How does your code look for creating the configuration and opening the realm?
BTW: It is typically better to open a new issue.
Just saw this was closed but cant see a new issue raised yet so thought we would pop here:
@nielsenko we have also seen similar behaviour - to get around this we had to included the 'embedded object' inside Configuration
<SchemaObject>[
. We assumed 'embedded objects' would not have to be included within the Configuration
<SchemaObject>[
- in our case this approach would lead to 100s of additional SchemaObject
(i.e. 'embedded objects') within the Configuration
<SchemaObject>[
which is not ideal from a readability or maintainability perspective. Meaning to raise this, so good @ffelicioautodoc raised, thanks!
Oi@ffelicioautodoc
Como seu código procura criar a configuração e abrir o realm?
BTW: Normalmente é melhor abrir um novo problema.
So I will open a new issue as you suggested.
Thank you for your help.
@dotjon0 and @ffelicioautodoc
That is correct, you need to add the Address.schema
to the schemaObjects
argument when creating the configuration. This is what I suspect you are missing @ffelicioautodoc.
@dotjon0 I see your point, but that is a current requirement. Embedded objects are not that different from top level objects internally in realm-core.
But we should be able help you add the transitive closure of all dependencies.
@dotjon0 and @ffelicioautodoc
That is correct, you need to add the
Address.schema
to theschemaObjects
argument when creating the configuration. This is what I suspect you are missing @ffelicioautodoc.@dotjon0 I see your point, but that is a current requirement. Embedded objects are not that different from top level objects internally in realm-core.
But we should be able help you add the transitive closure of all dependencies.
So I will do as you suggested.
At creation I was not including the Address schema in the settings. I just left them like this:
final config = Configuration.flexibleSync(
user,
[
Person.schema,
],
);
Thanks a lot for the help @nielsenko and @dotjon0. You guys saved a life here.
@nirinchev thanks for confirmation - ive raised a feature request https://github.com/realm/realm-dart/issues/1001 to support not having to place 'embedded objects' within the Configuration<SchemaObject>.
@ffelicioautodoc pleasure.
Have a good evening both.
@nielsenko what do you mean by "But we should be able help you add the transitive closure of all dependencies." ?
@nirinchev thanks for confirmation - ive raised a feature request #1001 to support not having to place 'embedded objects' within the Configuration.
@ffelicioautodoc pleasure.
Have a good evening both.
Thanks for the mention @dotjon0
Good evening and thanks again for your help.
@dotjon0 let us continue in #1001 👍