Home > Mobile >  I can not display Image network in flutter web
I can not display Image network in flutter web

Time:01-04

image

My error:

*══╡ 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 *

CodePudding user response:

You need to build web using --web-renderer html tag, run following command from project root in terminal:

flutter run -d chrome --web-renderer html

To display images on flutter web, using --web-renderer canvaskit won't work!

  • Related