calculateImageDimension static method

Future<Size> calculateImageDimension(
  1. Image image
)

Implementation

static Future<Size> calculateImageDimension(Image image) {
  Completer<Size> completer = Completer();

  image.image.resolve(const ImageConfiguration()).addListener(
    ImageStreamListener(
      (ImageInfo image, bool synchronousCall) {
        var myImage = image.image;
        Size size = Size(myImage.width.toDouble(), myImage.height.toDouble());
        completer.complete(size);
      },
    ),
  );
  return completer.future;
}