Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CachedNetworkImage image does not change with same name

Tags:

flutter

dart

I'm using https://pub.dev/packages/cached_network_image for display network image.

I came across with curious issue. Here I'm setting my profile image and url of profile image will be same, Only image will be changed.

Suppose if, First time I upload profile image then I will get url like "https://xx.yyy/user/profileAvatar" First time all works fine. But when I change profile image second time I will get same url as above with new image. But issue is here CachedNetworkImage can't able to load my new image.

Need your guidance to solve this issue.

PS. : I know, If I delete previous image from cache directory before uploading second one it will solve my issue.

UPDATED:

OMG, Same things even doesn't work with Image.network too.

like image 371
iPatel Avatar asked Oct 15 '22 14:10

iPatel


1 Answers

If an image changes, I would consider that to be a new resource. If we consider it to be a new resource, then it should really have a new resource locator (i.e. new URI) associated with it. Caching images anywhere (in a browser, CDN, etc.) becomes pretty challenging if they are updating but using the same URI.

like image 199
Jordan Nelson Avatar answered Oct 20 '22 22:10

Jordan Nelson