Hive box items are not restored when I factory reset my android phone and restore app data

322 Views Asked by At

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.

  1. Data backup at Setting
  2. Factory reset my phone
  3. 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());
}
0

There are 0 best solutions below