【发布时间】:2022-01-04 14:41:24
【问题描述】:
我有一个问题,我正在使用cached_network_image 包从网络缓存图像,我的问题是,我们可以更新缓存的图像吗?因为如果我更新图像(URL 保持不变),应用程序将显示旧图像而不是新图像,我需要先清除缓存以使应用程序显示最新图像。或者缓存的图像是否有过期时间?谢谢。
CachedNetworkImage(
imageUrl: dokter.foto,
imageBuilder: (context, imageProvider) => CircleAvatar(backgroundImage: imageProvider),
progressIndicatorBuilder: (context, url, downloadProgress) =>
Center(
child: CircularProgressIndicator(
value: downloadProgress.progress,
color : Constant.color
),
),
errorWidget: (context, url, error) => Image.asset("assets/images/profileAvatar.png")
)
【问题讨论】:
-
你能详细描述一下吗?
-
@DipakRamoliya 好的,简单来说,如果我更新图像但使用相同的 URL,它将显示旧图像而不是最新图像,所以我想知道是否有任何方法可以更新图像而不是清除缓存。
-
当你更新新图像时使用时间戳而不是使用名称
标签: flutter