Closed wer-mathurin closed 3 years ago
Due to CORS issues when running on Flutter Web it may block at some point. This is not a problem in general if you use a cors-proxy. But there is on bug at least in the code:
In the Util.dart
Future<Size> _getImageSize(String url) { final stream = Image.network(url).image.resolve(ImageConfiguration.empty); final completer = Completer<Size>(); void onError(Object e, StackTrace? __) { print(e); } void listener(ImageInfo info, bool _) { if (!completer.isCompleted) { completer.complete( Size( height: info.image.height.toDouble(), width: info.image.width.toDouble(), ), ); stream.removeListener(ImageStreamListener(listener, onError: onError)); } } stream.addListener(ImageStreamListener(listener, onError: onError)); return completer.future; }
The problem is that the completer never complete is it encounter a CORS problem for fetching the image. At least you can change the onError to:
void onError(Object e, StackTrace? s) { completer.completeError(e, s); }
Released in v2.2.2. Thanks for the PR!
Due to CORS issues when running on Flutter Web it may block at some point. This is not a problem in general if you use a cors-proxy. But there is on bug at least in the code:
In the Util.dart
The problem is that the completer never complete is it encounter a CORS problem for fetching the image. At least you can change the onError to: