isar / isar/hive

Hive returns edited object instead of the original one

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

Description

**Steps to Reproduce**
I open the box and search for all the objects.
I choose an object and edit a field, but I don't record it in the box.
I search again for the same object in the box using the ID.
The box returns the edited object, not the original.

[Github demo](https://github.com/daybson/notworking.git)

**Code sample**
```
_box = await Hive.openBox('Foo');
var all = _box!.values;
var someObj = all[x]; // someObj.Id is 2 and someObj.Name is 'Luiz', for example
someObj.name = 'Dave'; //change to Dave, but don't update the box
var anotherObj = _box!.get(2); //search the original object
print(anotherObj.name); //prints the 'Dave' instead 'Luiz'
```

**Version**
- Platform: Android
- Flutter version: 2.2
- hive: ^2.0.4
- hive_flutter: ^1.0.0
- hive_generator: ^1.1.0

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.