I am using Hive in my Flutter app, and in most spots, it works as desired. However, I've noticed that when saving values in one section, I have an issue when restarting the app after I've closed it from Android Studio.
Here's the situation:
In my main file:
await Hive.initFlutter();
var boxSelected = await Hive.openBox('selectedBox');
WidgetsFlutterBinding.ensureInitialized();
Then, in another page in my app I add and remove to that box using put(key, value) and delete(key). This actually all works while my app is running. And just FYI, I am importing Hive in that page file and referencing the same box.
However, let's say over the course of my app session I've added 5 objects (just regular map key/value items), and then deleted 3 of them, I would expect that after I restart the app I would only have 2 items left (like how I left it). That's not the case.
What's happening is when I restart the app, it's auto populating the db with all 5 items.
I'd really like to know why this is happening, and also, how to fix it.
Like I said, I implement multiple Hive boxes in my app, and they all work fine.
Thanks for any help. Let me know if you need more info.