isar / isar/hive

Avoid duplicating objects.

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

Description

**Question**
How to avoid duplicating objects in datastore?
What is the best practice let Hive know that the object must be overridden or ignored instead of duplicating.

**Code sample**
Future addCountries(List countries) async {
final Box box = await openDataBox();
box.addAll(countries);
}

Future> getCountries() async {
final List countries = [];
final Box box = await openDataBox();
countries.addAll(box.values.toList());
return countries;
}

**Version**
- Platform: iOS, Android, Web
- Flutter version: [ 2.5.3]
- Hive version: [2.0.4]

```[tasklist]
### Tasks
- [ ] https://github.com/isar/hive/issues/1261
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the addCountries and getCountries entry points shown in the issue, then review the linked task #1261 for the current direction. The issue is complete only once the intended behavior for existing objects—override, ignore, or another policy—is decided and clearly documented or implemented.

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
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.