isar / isar/hive

Support for record types

Open
#1,263 0 comments 4 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
4.4k
Forks
449
PR merge metrics
No merged PRs in 30d

Description

Since Dart 3 we have had [records](https://dart.dev/language/records). They're great and I use them extensively. I just ran into a problem though - Hive doesn't seem to support them yet, and whenever trying to save objects that include them, you get an error like this:

`HiveError (HiveError: Cannot write, unknown type: (int, int). Did you forget to register an adapter?)`

It's also **not** possible to generate type adapters like this:
```dart
@HiveType(typeId: 3)
typedef IntVec = (int, int);
```

(although this solution would not be great anyway)

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the Dart 3 records case described in the issue, including the `(int, int)` value and the shown `@HiveType` typedef. Then trace Hive's handling of unknown types and adapter generation; done means objects containing records can be saved without the reported HiveError.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.