-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RDART-1010: Allow configuration of generator per realm model class #1641
Conversation
Pull Request Test Coverage Report for Build 8738189165Details
💛 - Coveralls |
This can be used to configure the style of constructor to use when generating realm object classes. A new RealmModel.using ctor allows the user to pass an GeneratorConfig instance when annotating a class.
1153c43
to
9ca1297
Compare
String get plural => switch (this) { | ||
RealmCollectionType.list => 'lists', | ||
RealmCollectionType.set => 'sets', | ||
RealmCollectionType.map => 'maps', | ||
_ => 'none' | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A small drive by edit. Not related to this PR
@@ -13,15 +13,15 @@ class WithPrivateFields extends _WithPrivateFields | |||
|
|||
WithPrivateFields( | |||
String _plain, { | |||
int _withDefault = 0, | |||
int withDefault = 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually fixing a bug in version 2.1.0. Named arguments cannot start with underscore.
Person({ | ||
required String name, | ||
int age = 42, | ||
}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The interesting bit
/// The base type of the generated object class | ||
final ObjectType baseType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you okay with this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's a big deal. I don't imagine anyone has any code that reads this value.
Co-authored-by: Nikola Irinchev <[email protected]>
Can someone tell me how to implement this in Real: 2.1.0? These lines are resulting in references not found: What class should I import? |
This feature is not released yet. It will go out with the next release. |
Support per realm model configuration of the generator via the
GeneratorConfig
class. Currently we only support specifying the constructor style to use, as this has been a very frequent request (see #292).will generate a constructor like:
Fixes: #292
Fixes: #1642