-
Notifications
You must be signed in to change notification settings - Fork 106
Description
What happened?
I wonder how to include custom objects on Realm class which I could found nowhere on the doc.
Repro steps
@RealmModel()
class _CustomField{
// The tag if the custom field is a single string or a double string.
late final String type;
// The single field.
late final String? single;
// The double fields.
late final String? our;
late final String? their;
}
The codes above runs with no error. Then I tried
@RealmModel()
class _CustomField{
// The tag if the custom field is a single string or a double string.
late final String type;
// The single field.
late final String? single;
// The double fields.
late final String? our;
late final String? their;
}
@RealmModel()
class _CustomFields{
late List<CustomField> customFields;
}
Now it complains List<CustomField> is not a realm model type
. Even without List
the issue exists.
ChatGPT told me to add a label @RealmEmbedded
but it doesn't seem to work. Dart language server complains Undefined name 'RealmEmbedded' used as an annotation. Try defining the name or importing it from another library.
The script complains Could not resolve annotation for 'class _CustomField'.
What's more: What would it happen if I try to use an abstract class object as a data field of a Realm object? How to express things like Rust enums or C/C++ unions?
Version
Dart 3.5.1 Flutter 3.24.1
What Atlas Services are you using?
Local Database only
What type of application is this?
Flutter Application
Client OS and version
Windows 11 21H2
Code snippets
No response