isar / isar/hive

Model Adapter of a model within a model

Open
#526 9 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Dart
Stars
4.4k
Forks
449
PR merge metrics
No merged PRs in 30d

Description

Using Hive in Flutter, I have to generate a Model Adapater by annotating my Model:

```
import 'package:connectivity/connectivity.dart';
import 'package:flutter/material.dart';
import 'package:hive/hive.dart';

part 'internet_connection.g.dart';

@HiveType(typeId: 3)
class InternetConnection {
InternetConnection({
@required this.status,
});

@HiveField(0)
ConnectivityResult status;
}
```

This fails and throws the Exception

> [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: HiveError: Cannot write, unknown type: ConnectivityResult. Did you forget to register an adapter?

From what I can gather, I will need to do additional annotation to have the Model ConnectivityResult be seen by Hive. What additional logic would I need to provide to get around this?

**Version**
- Platform: iOS, Android
- Flutter version: 1.23.0-18.1.pre • channel beta
- Hive version: ^1.4.4+1

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.