flutter 设置缓存的方法

Dart 复制代码
final prefs = await SharedPreferences.getInstance();
  1. 设置缓存
Dart 复制代码
prefs.setString(key, data);

2.读取缓存

Dart 复制代码
prefs.getString(key)

3.清除缓存

Dart 复制代码
prefs.remove(key);

其中 key 是要钥匙 data 是要处理的值,这里是字符串

相关推荐
好的佩奇2 小时前
Dart 之扩展方法
android·flutter·dart
FungLeo4 小时前
成为全栈·基础补充·缓存的层次与失效:浏览器、CDN、服务端、数据库
缓存·cdn·数据一致性·http缓存·成为全栈·flutter缓存
好的佩奇5 小时前
蓝牙之经典蓝牙
android·flutter·蓝牙
传奇开心果编程7 小时前
【Flutter踩坑排雷】第19课:路由硬编码坑|字符串路由书写错误,页面跳转失败排查
android·flutter·ios·移动开发·跨平台·ui框架·声明式ui
code2cat10 小时前
【随笔】KV缓存量化:省下的显存,要付出多少数值误差
人工智能·缓存·大语言模型
csdn_aspnet10 小时前
Redis 入门:Windows、Mac安装指南
数据库·windows·redis·缓存·mac
Pniubi12 小时前
缓存击穿的解决方案
缓存
Nerd(BUG版)1 天前
Flutter学习day5--事件手势与命中测试
学习·flutter
传奇开心果1 天前
【Flutter踩坑排雷】第5课:扩展方法冲突坑|同名扩展引发编译歧义,故障规避手段
android·flutter
code2cat1 天前
【随笔】KV缓存卸载:逐层预取能藏住多少传输时间
人工智能·缓存·大语言模型