isar / isar/hive

How can I do with reordedListView()?

Open
#826 0 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

**Question**
I trying to get reorderedList to work with hive.
But how can I do it correctly, the right way?
**Code sample**

[Tried this snippet](https://stackoverflow.com/questions/64239870/flutter-hive-how-to-save-reordered-list-in-hive)

Also I came up my own code snippet but it work not so well...

```dart
onReorder: (int oldIndex, int newIndex) {
var copyQuiz = quizBox.getAt(oldIndex);
quizBox.deleteAt(oldIndex);

if (newIndex > oldIndex)
quizBox.putAt(newIndex - 1, copyQuiz!);
else
quizBox.putAt(newIndex, copyQuiz!);
setState(() {});
}
```

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Review the linked Stack Overflow snippet and the onReorder callback shown in the issue body, then compare the approach with Hive 2.0.4 behavior on the listed platforms. Done means the reordered list is persisted correctly and retains its order after reopening.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.