Whenever App is restarted hive database gets cleared
- Dominant language
- Dart
- Stars
- 4.4k
- Forks
- 449
- PR merge metrics
- No merged PRs in 30d
Description
**Question**
Whenever I restart my app hive database gets cleared & show null check error, but if i close the app in background it works properly.
**Code sample**
```dart
await Hive.initFlutter();
Hive.registerAdapter(ProgressListAdapter());
Hive.registerAdapter(VideoListAdapter());
Hive.registerAdapter(DashBoardAdapter());
Hive.registerAdapter(CourseDetailsAdapter());
Hive.registerAdapter(AnnouncementsListDataAdapter());
Hive.registerAdapter(VideoAssignmentsAdapter());
Hive.registerAdapter(LessonDetailAdapter());
Hive.registerAdapter(CourseQuestionsAdapter());
await Hive.openBox("box");
await Hive.openBox("video_box");
await Hive.openBox("dashboard_box");
await Hive.openBox("course_box");
await Hive.openBox("announcement_box");
await Hive.openBox("vfs_feedback_box");
await Hive.openBox("lesson_box");
await Hive.openBox("questions_box");
await Hive.openBox("video_record_box");
```
**Version**
- Platform: iOS, Android, Mac, Windows, Linux, Web
- Flutter version: [3.0.2]
- Hive version: [2.2.3]
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the difference between restarting the app and closing it in the background using the shown Hive.initFlutter and Hive.openBox calls. Check whether the opened boxes retain their data after a full restart and identify why the null check error occurs. Done means the stored data remains available and the error no longer appears after restarting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100