如何使用Flutter保存到本地存储? [英] How to save to local storage using Flutter?

查看:1398
本文介绍了如何使用Flutter保存到本地存储?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android中,如果我有要在各个会话之间保留的信息,我知道我可以使用SharedPreferences或创建SQLite数据库,甚至将文件写入设备并在以后读取.

In Android, if I have the information I want to persist across sessions I know I can use SharedPreferences or create a SQLite database or even write a file to the device and read it in later.

有没有一种仅使用Flutter来保存和恢复数据的方法?还是我需要为Android和iOS编写特定于设备的代码,例如服务示例?

Is there a way to save and restore data like this just using Flutter? Or would I need to write device-specific code for Android and iOS like in the services example?

推荐答案

有一些选择:

  • Read and write files: https://flutter.io/reading-writing-files/
  • SQLite via a Flutter plugin: https://github.com/tekartik/sqflite
  • SQLCipher via a Flutter plugin: https://github.com/drydart/flutter_sqlcipher
  • SharedPreferences via a Flutter plugin: https://github.com/flutter/plugins/tree/master/packages/shared_preferences

这篇关于如何使用Flutter保存到本地存储?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆