我无法在flutter web中显示图像网络

yc0p9oo0  于 2023-01-06  发布在  Flutter
关注(0)|答案(1)|浏览(210)

我的错误:

*══╡ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE ╞════════════════════════════════════════════════════
The following ImageCodecException was thrown resolving an image codec:
Failed to detect image file format using the file header.
File header was [0x3c 0x21 0x44 0x4f 0x43 0x54 0x59 0x50 0x45 0x20].
Image source: http://localhost:49909/
When the exception was thrown, this was the stack:
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 266:49  throw_
lib/_engine/engine/canvaskit/image_web_codecs.dart 52:7                       create
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54            runBody
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 123:5            _async
lib/_engine/engine/canvaskit/image_web_codecs.dart 35:46                      create
lib/_engine/engine/canvaskit/image.dart 88:34                                 skiaInstantiateWebImageCodec
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 45:50            <fn>
dart-sdk/lib/async/zone.dart 1653:54                                          runUnary
dart-sdk/lib/async/future_impl.dart 147:18 *
e0bqpujr

e0bqpujr1#

您需要使用**--web-renderer html**标记构建Web,请从终端中的项目根目录运行以下命令:

flutter run -d chrome --web-renderer html

要在flutter web上显示图像,使用**--web-renderer canvaskit**不起作用!

相关问题