0

If I have a new version of my Flutter-App und want to delete/remove my old Hive-boxes before my new app-version starts with runApp(MaterialApp ...

What is the correct way to implement that?

I'm new to Flutter and I experienced problems when changing the type of a box-content. So my idea was to be on the save side with deleting/removing and re-init everything with each new version of my app.

But maybe I am wrong?

Thank your for your help!!!

leftjoin
  • 36,950
  • 8
  • 57
  • 116
KarlB
  • 1
  • 2
  • You can't do this before start... But you may check if saved (fx in shared preferences) previously version is older than new version and delete them and then save version right after application start – Selvin Oct 29 '21 at 08:21

1 Answers1

0

to remove all boxes Hive.deleteFromDisk(); immediately after opening all boxes, add something like if(thisAppIsNew) => Hive.deleteFromDisk(); you can use Upgrader package for get a new version or xml file on the server

novol
  • 832
  • 4
  • 20