Skip to content

Instantly share code, notes, and snippets.

@ali2236
Created March 2, 2022 18:17
Show Gist options
  • Save ali2236/84feffbfa915a2ce6d5952f8edf6dfbb to your computer and use it in GitHub Desktop.
Save ali2236/84feffbfa915a2ce6d5952f8edf6dfbb to your computer and use it in GitHub Desktop.
Future<Size> resolveSize(ImageProvider image) async {
final resultController = StreamController<Size>();
resolve(image, (info, _) {
final size = Size(
info.image.width.toDouble(),
info.image.height.toDouble(),
);
resultController.sink.add(size);
});
late Size temp;
await for (var result in resultController.stream) {
resultController.close();
temp = result;
break;
}
return temp;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment