isar / isar/hive

define fromJson ,fromMap with key

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

Description

When my class is extending `HiveObject` I have access to `key` using the getter defined in `HiveObject` but after sending the class instance through the network as json I need to convert it back to a model using `Model.fromMap(Map map)` but I can't set the key since it is private and the `HiveObjectMixin` is not defining a setter

```dart
class User extends HiveObject {
final String name;

User({required this.name});

factory User.fromMap(Map map) {
return User(
name: map['name'], // <

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.