【发布时间】:2021-10-02 16:32:52
【问题描述】:
我正在尝试将数据列表保存到共享偏好并阅读这些文章,但不适用于我:
Flutter save List with shared preferences
Shared Preferences in Flutter cannot save and read List
我有这份清单:
var list =[
{
"id" : 1,
"name" : "ali"
},
{
"id" : 2,
"name" : "jhon"
}
];
我试过了:
setList() async {
Future<SharedPreferences> _prefs = SharedPreferences.getInstance();
final SharedPreferences prefs = await _prefs;
prefs.setStringList('list', list);
}
我收到此错误:The argument type 'List<Map<String, Object>>' can't be assigned to the parameter type 'List<String>'
【问题讨论】:
-
我在考虑如何找回它们?
-
@YeasinSheikh 怎么样?
标签: list flutter sharedpreferences