listenable API - can the code be less clumsy?
- Dominant language
- Dart
- Stars
- 4.4k
- Forks
- 449
- PR merge metrics
- No merged PRs in 30d
Description
First of all, this is by far the most awesome DB I've seen thanks to its simplicity!
I'm wondering if there's a better way to listen to values.
Currently, if I'll try something like this (within my business logic code):
**Code sample**
```dart
void listenConversation(String conversationId,VoidCallback listener){
conversationsBox.listenable(keys:[conversationId]).addListener(listener);
}
void removeListnerConversation(String conversationId,VoidCallback listener){
conversationsBox.listenable(keys:[conversationId]).removeListener(listener);
}
```
the listener isn't actually being removed (probably because .listenable creates a new object).
So I have to save each listener in some container. Which is okay,but in turn that does mean that I also have to track the number of listeners (because Listenable doesn't have API to get num of listeners) and remove listeners for which no one listens so that the garbage collection can do its work.
I'm just wondering if there's a better way to do things from my side or from Hive's side.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.