Is making a public API for `keystore.autoIncrement()` a good idea?
- Dominant language
- Dart
- Stars
- 4.4k
- Forks
- 449
- PR merge metrics
- No merged PRs in 30d
Description
If you have an ID property on your object:
```dart
class Person{
int id;
String name;
Person({this.id,this.name});
}
```
and want to use the auto-increment functionality of the box.add() method you'd have to write on database twice:
```dart
var mario = Person(name: 'mario');
var key = await box.add(mario);
mario.id = key;
await box.put(key, mario);
```
but if we had a auto-increment API we could do something like:
```dart
var mario = Person(name: 'mario');
mario.id = box.getTheNextKey();
await box.put(mario.id, mario);
```
would something like this make sense for hive? is there already a way to get the auto-incremented key? I know we can generate our own key but I can't think of a way that's not more expensive than package's own implementation.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.