objectbox / objectbox/objectbox-dart
store.watch<Entity> - return changes instead of void
Nobody has claimed this yet.
- Dominant language
- Dart
- Stars
- 1.2k
- Forks
- 162
- Avg merge
- 15m
- Merged PRs (30d)
- 1
Description
I try to hook up a custom REST synchronization service to entity changes and have something like this to listen to model changes:
final objectBox = await ObjectBox.create();
...
final stream = objectBox.store.watch<FormAnswer>();
stream.listen((event) {
print('answers changed');
// sync the changed model with server
});
Describe the solution you'd like
I actually would expect the stream to return the entity that changed. Returning a Stream with void does not make too much sense in my opinion. You get informed that 'something' changed, without knowing what...
I've seen there is also the option to subscribe to objectBox.store.entityChanges which kinda does, what I want. It's just not as convenient as the first one, since you'd have to switch through all Entity types first, to handle them accordingly.
Just an idea for a future version ;-)
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.
Research direction
Start with the store.watch entry point and compare its behavior with objectBox.store.entityChanges, both mentioned in the issue. Determine the intended entity payload and API implications; done means a watch stream provides the changed entity in a way that supports synchronization without switching across entity types.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100