A previous question on stack overflow discussed obtaining an image's size to which someone posted an answer
Future<ui.Image> _getImage() {
Completer<ui.Image> completer = new Completer<ui.Image>();
new NetworkImage('https://i.stack.imgur.com/lkd0a.png')
.resolve(new ImageConfiguration())
.addListener((ImageInfo info, bool _) => completer.complete(info.image));
return completer.future;
}
Unfortunately the above code will not compile due to complete.complete(info.image)
having an error in Android Studio which says:
the argument type 'image' can't be assigned to the parameter type 'FutureOr'
Could someone suggest how to correct the code so that the Completer object will work properly?
I would ask the original poster of the accepted answer but I don't have enough reputation to comment yet. So I am asking the question here.
The link to the original post is here:
How do I determine the width and height of an image in Flutter?