ElCacheImage class

网络图片缓存类,此类相当于 NetworkImage,你需要使用 Image 小部件加载它, 代码示例:

Image(
  image: ElCacheImage('url').build(),
),

Constructors

ElCacheImage(String url, {double scale = 1.0, Map<String, String>? headers, WebHtmlElementStrategy webHtmlElementStrategy = WebHtmlElementStrategy.never, Duration expire = const Duration(days: 3), bool? enabledCacheSize})

Properties

cacheSize Size?
访问图片缓存尺寸
no setter
enabledCacheSize bool?
是否将图片尺寸信息缓存到本地
final
expire Duration
设置本地缓存过期时间
final
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>?
设置图片请求头
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scale double
设置图片缩放
final
url String
加载网络图片地址
final
webHtmlElementStrategy WebHtmlElementStrategy
这个属性仅作用于 Web 平台,用来决定选择哪种方式渲染图片:
final

Methods

build() ImageProvider<Object>
构建自适应平台的 ImageProvider 对象,由于 Web 平台存在 CORS 问题, 所以在 Web 端返回 NetworkImage 对象,在客户端则返回 _CacheImage 对象
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setImageCache([Size? size]) → void
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

clearCache() Future<void>
清除图片缓存