cached_network_image_max 3.5.0 copy "cached_network_image_max: ^3.5.0" to clipboard
cached_network_image_max: ^3.5.0 copied to clipboard

Flutter 升级 3.35.7 之后,对 cached_network_image 插件的升级(After Flutter upgrade 3.35.7, the upgrade of cached_network_image plugins.)。

Cached network image max #

pub package codecov Build Status

A flutter library to show images from the internet and keep them in the cache directory.

技术支持邮箱(1539841933@qq.com)。 #

Sponsors #


Try the Flutter Chat Tutorial 💬

How to use #

The CachedNetworkImage can be used directly or through the ImageProvider. Both the CachedNetworkImage as CachedNetworkImageProvider have minimal support for web. It currently doesn't include caching.

With a placeholder:

CachedNetworkImage(
        imageUrl: "http://via.placeholder.com/350x150",
        placeholder: (context, url) => CircularProgressIndicator(),
        errorWidget: (context, url, error) => Icon(Icons.error),
     ),

Or with a progress indicator:

CachedNetworkImage(
       imageUrl: "http://via.placeholder.com/350x150",
       progressIndicatorBuilder: (context, url, downloadProgress) => 
               CircularProgressIndicator(value: downloadProgress.progress),
       errorWidget: (context, url, error) => Icon(Icons.error),
    ),
Image(image: CachedNetworkImageProvider(url))

When you want to have both the placeholder functionality and want to get the imageprovider to use in another widget you can provide an imageBuilder:

CachedNetworkImage(
  imageUrl: "http://via.placeholder.com/200x150",
  imageBuilder: (context, imageProvider) => Container(
    decoration: BoxDecoration(
      image: DecorationImage(
          image: imageProvider,
          fit: BoxFit.cover,
          colorFilter:
              ColorFilter.mode(Colors.red, BlendMode.colorBurn)),
    ),
  ),
  placeholder: (context, url) => CircularProgressIndicator(),
  errorWidget: (context, url, error) => Icon(Icons.error),
),

How it works #

The cached network images stores and retrieves files using the flutter_cache_manager.

FAQ #

My app crashes when the image loading failed. (I know, this is not really a question.) #

Does it really crash though? The debugger might pause, as the Dart VM doesn't recognize it as a caught exception; the console might print errors; even your crash reporting tool might report it (I know, that really sucks). However, does it really crash? Probably everything is just running fine. If you really get an app crashes you are fine to report an issue, but do that with a small example so we can reproduce that crash.

See prior discussions in the issue tracker for similar cases.

0
likes
140
points
86
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Flutter 升级 3.35.7 之后,对 cached_network_image 插件的升级(After Flutter upgrade 3.35.7, the upgrade of cached_network_image plugins.)。

Topics

#cache #image #network-image

License

MIT (license)

Dependencies

cached_network_image_max_platform_interface, cached_network_image_max_web, flutter, flutter_cache_manager, octo_image

More

Packages that depend on cached_network_image_max