Reputation: 8546
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.
Upvotes: 2
Views: 285
Reputation: 1893
The flutter_secure_storage package seems to have more following and is maintained:
https://pub.dev/packages/flutter_secure_storage
It relies on Keychain / Keystore to store this data.
Upvotes: 0
Reputation: 828
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.
Upvotes: 1