getImageSize static method
Implementation
static Future<Size> getImageSize(String imagePath) async {
final bytes = await File(imagePath).readAsBytes();
final completer = Completer<Size>();
final imageStream =
Image.memory(bytes).image.resolve(ImageConfiguration.empty);
imageStream.addListener(ImageStreamListener((imageInfo, _) {
completer.complete(Size(
imageInfo.image.width.toDouble(), imageInfo.image.height.toDouble()));
}));
return completer.future;
}