'Data is not persisting for IndexedDB using Flutter and package Hive on web(chrome) browser

I'm using the flutter package Hive The problem that I am encountering is that my website's data is not persisting for IndexedDB - web(chrome)

Has anyone else encountered inconsistency with data stored in IndexedDB for chrome? Are there any additional steps outside of using the Hive package such as requesting persistent permission that I have to implement in order for the data to be stored?

Any feedback will be appreciated.



Solution 1:[1]

You don't even need to request the persistent storage permission to be able to store data. Persistent storage just makes it a bit more durable. So most likely, the data is never being written to IndexedDB in the first place. Could be an issue with your code or with a library you're using. Hard to say without seeing your code, especially since I've never used Hive.

Solution 2:[2]

This is a flutter project, using the hive package. It works fine on mobile devices, but when running the app in chrome the data gets lost after a refresh

Data after the initial load and initialisation Data after the initial load and initialisation

Empty boxes after refresh Empty boxes after refresh

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 dumbmatter
Solution 2 Theuno de Bruin