I used https://pub.dev/packages/cached_network_image to cache images it's work with pages but when I re open the app again it reload the image again, I need to store the image on mobile with database and call it again or something like that
if when you enter again it reloads the image it is because something failed with the cache, try with this code use these plugins
cached_network_image: ^3.0.0 flutter_cache_manager: ^3.2.0
static final customCacheManager = CacheManager(Config('customCacheKey',
stalePeriod: Duration(days: 15), maxNrOfCacheObjects: 100));
CachedNetworkImage(
cacheManager: customCacheManager,
height: 40,
width: 40,
fit: BoxFit.cover,
imageUrl: imageUrl,
placeholder: (context, url) => CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(Colors.white),
backgroundColor: const Color(0xFF02204c),
),
errorWidget: (context, url, error) => Center(
child: Image.asset(
'assets/images/errorImage.png',
height: 60,
width: 60,
),
),
),
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.