jonataslaw / get_storage

A fast, extra light and synchronous key-value storage to Get framework
MIT License
359 stars 82 forks source link

GetStorage is not reliable for cross-thread operations. #130

Open Wing-Li opened 1 year ago

Wing-Li commented 1 year ago

I am using flutter_background_service.

After reviewing the source code of GetStorage, it seems that it only reads data from the local disk once on startup and stores it in memory. All subsequent storage and retrieval operations are performed in memory. However, background services run on a separate thread from the main thread, so operations performed in the main thread's memory cannot be synchronized with the background thread. Even if initialized in the background service, it would be ineffective because once the background service is started, it will not close again by default. Even if GetStorage.init() is called, it will simply return the previously fetched value from the background thread's memory without fetching a new one.

AnthonyRootdevs commented 11 months ago

did you fixed it .?