如何使用Flutter保存到本地存储?
问题内容:
在Android中,如果我拥有要在会话之间保留的信息,我知道我可以使用SharedPreferences或创建SQLite数据库,甚至将文件写入设备并在以后读取。
是否可以仅使用Flutter来保存和还原此类数据?还是我需要像服务示例中那样为Android和iOS编写设备特定的代码?
问题答案:
有几种选择:
- 读写文件:https://flutter.io/reading-writing-files/
- 通过Flutter插件的SQLite:https : //github.com/tekartik/sqflite
- 通过Flutter插件的SQLCipher:https : //github.com/drydart/flutter_sqlcipher
- 通过Flutter插件的SharedPreferences:https : //github.com/flutter/plugins/tree/master/packages/shared_preferences