Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
240 views
in Technique[技术] by (71.8m points)

How to store asset Images in cache in flutter

I have some images to show in my application and those images are big in size so I want to store them in cache. On tap of a button I am changing all the images to other set of images and it looks bad when changing it as all of them load again and again. I tried many solutions but none works for me till now.

I tried using the method below but I see no difference in the loading of the images.

precacheImage(AssetImage("path"), context);

Is there a way to like save images so when I change the images they won't load again (Any package and its implementation or even dart code would do). Thanks


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can use the cached_network_image package. With that, you are able to display images. After showing them once, they are cached and easy to reuse.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...