I have an Flutter app where I store some data using Hive. It seemed everything worked fine. But it happened when I factory reset my android phone.
Here's what I did.
- Data backup at Setting
- Factory reset my phone
- Restore data
What I expected was that Step 3 would restore the Hive box items as well. But I could not see them when I opened my app. I have no idea why it happened. Can anyone explain it? and how can I fix it?
main.dart
void main() async {
//Hive box open
await Hive.initFlutter();
Hive.registerAdapter(NoteModelAdapter());
Hive.registerAdapter(NoteSettingAdapter());
await Hive.openBox<NoteModel>('mynote');
await Hive.openBox<NoteSetting>('mysetting');
runApp(const MyApp());
}