objectbox / objectbox/objectbox-dart
Add support for property converters
@greenrobot-team is already working on this.
Since Jul 5, 2022.
- Dominant language
- Dart
- Stars
- 1.2k
- Forks
- 162
- Avg merge
- 15m
- Merged PRs (30d)
- 1
Description
Hi, I'm a relatively new ObjectBox user, so firstly let me say thanks for what looks like an awesome library 💪
I'm investigating how I might go about encoding custom types in my current application. I've seen this (closed) issue about supporting custom types https://github.com/objectbox/objectbox-dart/issues/93 and I've also seen the example Dart code in https://docs.objectbox.io/advanced/custom-types#convert-annotation-and-property-converter.
The problem is that the pattern suggested here isn't really scalable. It means a bunch of boilerplate to create a backing variable (which will be ignored by ObjectBox) and then creating a getter/setter that wraps around that variable. When I'm interacting with this object, it means there's another "variable" (dbXXX) that could be interacted with (but should never be). Plus, all this boilerplate needs to be copied/pasted into every class that happens to embed the custom type we're trying to convert.
I guess what I'm seeking is something like the Kotlin/Java @Convert annotation so that my classes are nice and clean, and I've got reusable converter classes. Is this something being considered?
Apologies if if the above sounds like it is negative... I don't intend it that way. Thanks again for an amazing library.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.