-
引入头
import 'dart:ui' as ui;
-
其次获取图片,主要是用到
ui.Image
里的addListener
方法。var imagePath = ""; var image = Image.file(File(imagePath)); Completer<ui.Image> completer = new Completer<ui.Image>(); image.image .resolve(new ImageConfiguration()) .addListener(ImageStreamListener((ImageInfo info, bool _) { completer.complete(info.image); })); ui.Image info = await completer.future; int width = info.width; int height = info.height; print('-------------->>>${width}x${height}');
目前尚无回复