Dynamic S3 Bucket URL Caching Flutter
668
cached_network_image
has been updated to handle keys with the cacheKey
value. Check out the code below:
CachedNetworkImage(
cacheKey: "my-key",
imageUrl: _url!,
fit: BoxFit.cover,
progressIndicatorBuilder:
(context, url, downloadProgress) =>
Center(
child: Platform.isAndroid
? CircularProgressIndicator()
: CupertinoActivityIndicator(),
),
)
Author by
Dhananjayan PN
Updated on December 22, 2022Comments
-
Dhananjayan PN over 1 year
I would like to cache a Network Image from an S3 bucket URL against an id or key. I tried to use the key: parameter but it didn't work. Please advise how I can achieve this. Heres the Cached Network Image code with the 'key' parameter that doesn't seem to do what I intend.
CachedNetworkImage( key: Key(uni['university_name'].toString()), // Doesn't seem to do the job imageUrl: uni['image_url'], placeholder: (context, url) => CardPlaceHolder(), errorWidget: (context, url, error) => Padding( padding: EdgeInsets.all(21), child: Icon( Icons.error, size: 30, color: Colors.red.withOpacity(0.8), ), ), imageBuilder: (context, imageProvider) => ...