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

Operators

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

Static Methods

cacheImageFile(String imageUrl) Future<File?>
前提:你使用了cached_network_image来加载图片,根据图片url返回其缓存的File对象
openAppPermissionSettings() Future<bool>
saveBytes2Album(Uint8List bytes, {ImageByteFormat format = ImageByteFormat.png, String? fileName, int quality = 80}) Future<SaveResult?>
将图片保存到相册,返回路径
saveCacheImage2Album(String imageUrl, {String? fileName}) Future<SaveResult?>
前提:你使用了cached_network_image来加载图片,将图片url保存到相册,返回路径
saveFile2Album(String filePath, {String? fileName}) Future<SaveResult?>
将图片文件保存到相册,返回路径
saveImage2Album(ByteData bytes, {ImageByteFormat format = ImageByteFormat.png, String? fileName, int quality = 80}) Future<SaveResult?>
将图片保存到相册,返回路径
saveWidget2Album(GlobalKey<State<StatefulWidget>> key, {ImageByteFormat format = ImageByteFormat.png, String? fileName, int quality = 80}) Future<SaveResult?>
将widget转为图片保存到相册,返回路径 key所在节点必须是RepaintBoundary节点,否则会报错,截取 RenderRepaintBoundary 的内容
widget2image(GlobalKey<State<StatefulWidget>> key, {ImageByteFormat format = ImageByteFormat.png}) Future<ByteData?>
key所在节点必须是RepaintBoundary节点,否则会报错,截取 RenderRepaintBoundary 的内容