isar / isar/hive

Hive not storing Object when App restarts???

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

Description

Hello, in my Flutter App using Hive is all running correct till I restart the App. Then the box is empty and the Object is not stored?
Till I restart the App again, all is working fine. The Object is generated with the build_runner

```
@HiveType(typeId: 0)
class Favorites extends HiveObject {
@HiveField(0)
List mediaItems = [];
}

final document = await getApplicationDocumentsDirectory();
Hive
..init(document.path)
..registerAdapter(FavoritesAdapter())

await Hive.openBox('favorites');
.......

Box box = Hive.box('favorites');
Favorites fav = box.getAt(0) ?? Favorites();
fav.mediaItems.insert(0, playlist[i]);
```

The data are stored and when I restart the App the Box is empty???
Thanks for helping!

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.