Last updated:
0 purchases
fiona image cache
This package helps your app to cache an image when get it from an URI.
Features #
FionaImageCache downloads the image and saves it into your local path.
The next time the app read the same image, it will return the local path.
Getting started #
It's very simple to use, you only have to define the cache folder name where you want to save
the downloaded images.
Usage #
You have to create the manager with the repository and the local path where you want to download the images:
/* create cache */
var fionaCache = FionaImageCache(cacheFolder: "");
copied to clipboard
Then in your Flutter widget you can use the manager to get the image path from an url.
The first time, the cache will get the image from the url, download it & save it.
The next time you call this method with the same url, the cache will return the local uri of the image.
/* get image local path from cache */
String imagePath = await fionaCache.getImagePath(url);
/* and then you can create an image from the imagePath (local uri) */
Image image = Image.file(File(imagePath));
image.image.resolve(ImageConfiguration()).addListener(
ImageStreamListener((ImageInfo image, bool synchronousCall) {
var myImage = image.image;
Size size = Size(myImage.width.toDouble(), myImage.height.toDouble());
completer.complete(ImageCacheInfo(size, imagePath));
},
),
);
copied to clipboard
Additional information #
I've created a flutter package called FionaImage which uses this cache.
https://pub.dev/packages/fiona_image
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.