lawndart
lawndart copied to clipboard
Suggestion for abstract class Store<V> -- store.items()
I would like to do a suggestion for abstract class Store<V>, it has .keys() and .values() methods to retrieve keys and values, what about if you want to retrieve both of them?
Currently you can do something like this:
db.open().then((_) {
store.keys()
.listen((key) {
store.getByKey(key).then((value) => print('$key, $value'));
});
});
But I feel the code become more ugly. Something like this would be awesome:
db.open().then((_) {
store.items()
.listen((key, value) => print('$key, $value'));
});
Thanks and regards. Moises Belchin.
Interesting, thanks for the report! The Stream API lets me return only a single object in listen(), so I can't return both key and value via listen unless I wrap them both in a single object.