我有一个包含某些元素的GirdView,每个元素都有其自己的详细信息页面,我想详细添加按钮或图标以将其本地和永久保存在“收藏夹”页面中,以便用户以后可以找到它们采用。 是否有任何相关文档或教程?
答案 0 :(得分:0)
如果要在本地存储内容,可以尝试使用shared_preferences pub.dev。使用示例很简单:
_incrementCounter() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
int counter = (prefs.getInt('counter') ?? 0) + 1;
print('Pressed $counter times.');
await prefs.setInt('counter', counter);
}
有关更多信息,请访问medium guide