isar / isar/hive

Box keys: Custom types

Open
#754 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Dart
Stars
4.4k
Forks
449
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**
I'd like to use custom types for keys. A value of type 'Map' can't be returned from the function 'myBox' because it has a return type of 'Map'.

**Describe the solution you'd like**
When creating a box, we could specify the key's type.
```dart
final box = Hive.box('myBox');
```
This approach would be hard to use with `box.add` or `box.addAll`.

**Describe alternatives you've considered**
To remove the conflict I mentioned above, Hive could have another method called `Hive.keyBox`.

**Version**
- Platform: iOS, Android, Mac, Windows, Linux, Web
- Flutter version: 2.5.0
- Hive version: 2.0.4

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.