ImageUtil class
Properties
-
hashCode
→ int
-
The hash code for this object.
no setterinherited
-
runtimeType
→ Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a nonexistent method or property is accessed.
inherited
-
toString()
→ String
-
A string representation of this object.
inherited
Static Methods
-
clearBase64Cache()
→ void
-
清空base64缓存
-
detectImageFormat(String filePath)
→ Future<String?>
-
-
getAvatarWidget(String? imagePath, {String defaultImagePath = 'avatar_default_single.png', double? width, double? height, BoxFit fit = BoxFit.cover})
→ Widget
-
构建头像图片。头像地址为空或网络加载失败时展示指定的默认头像。
-
getBase64NaturalSize(String base64String)
→ Size?
-
获取 base64 图片的天然像素尺寸(使用 image_size_getter,命中缓存则直接返回)
-
getDecodedBase64(String base64String)
→ Uint8List?
-
从缓存中获取已解码的base64图片数据,如果不存在则解码并缓存
-
getFileNaturalSize(String filePath)
→ Size?
-
获取本地文件图片的天然像素尺寸(使用 image_size_getter,命中缓存则直接返回)
filePath 支持普通路径或以 file:// 开头的路径
-
getImageWidget(String imagePath, {double? width, double? height, bool inRongCloud = true, Color? color, BoxFit fit = BoxFit.cover, String? thumbnailBase64String, bool notInAssets = false, Widget? errorWidget})
→ Widget
-
获取图片 Widget,可以自动判断图片路径类型
-
limitCacheSize(int maxSize)
→ void
-
限制缓存大小,移除最早添加的项
-
removeFromCache(String base64String)
→ void
-
移除特定base64字符串的缓存