isar / isar/hive

Cannot delete objects in a box

Open
#749 0 comments 0 reactions 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 am able to easily add objects to a box. I can also read it to display in Listview builder which returns a search list of existing searches. I am now trying to make sure I do not get duplicate objects going into the box, therefore I have a check in place to search the box for a value and if it exists to delete it. For whatever reason, it does not delete the box. I have tried delete(key) deleteAt(index) no version of it deletes the box. When I go back to check the box the length before and after is always the same.

**Code sample**
```
onSelected: (myTile) {
var search = history.values
.where((element) => element.symbol == myTile.symbol);

if (search.length != 0) {
history.delete(2);
print(history.length);
history.deleteAt(search.elementAt(0).key);
history.delete(search.elementAt(0).key);
print(history.length);
}

```

**Version**
- Platform: Web
- Flutter version: 2.2.3
- Hive version: 2.0.4
- hive_flutter: 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.