您可以使用image.file构造函数从磁盘读取图像。
有关更多功能,您可以使用图片库
Dart库提供了以各种不同文件格式加载,保存和处理图像的功能。
来自文档示例的样本
加载jpeg,调整大小并将其另存为png
import 'dart:io' as Io; import 'package:image/image.dart'; void main() { // Read a jpeg image from file. Image image = depreImage(new Io.File('test.jpg').readAsBytesSync()); // Resize the image to a 120x? thumbnail (maintaining the aspect ratio). Image thumbnail = copyResize(image, width: 120); // Save the thumbnail as a PNG. new Io.File('out/thumbnail-test.png') ..writeAsBytesSync(enprePng(thumbnail)); }


