Flutter: Store critical data permanently to disk

Viewed 102

What the best way to save data for a CRUD app in Flutter, I've seen tutorial use SharedPreferences package for Android/iOS. My problem is this, according to Shared preference doc, Data may be persisted to disk asynchronously, and there is no guarantee that writes will be persisted to disk after returning, so this plugin must not be used for storing critical data., So now this package solves issue of saving file locally to device disk, but my fear is that there is no guarantee and am concerned about users losing their notes.

https://pub.dev/packages/shared_preferences

Another package I found online is https://pub.dev/packages/store_critical_data/example but I've not seen anyone using this so I'm doubting its reliability.

2 Answers

If your data is critical then it should not just be stored in local storage as local storage can be cleared, and is device dependent. Local storage is inherently unreliable.

Related