Flutter_cached_network_image: The function 'webOnlyInstantiateImageCodecFromUrl' isn't defined.

Created on 9 Mar 2021  ·  2Comments  ·  Source: Baseflow/flutter_cached_network_image

🐛 Bug Report


With flutter 2 the class _load_async_web.dart has an error when it's try call to webOnlyInstantiateImageCodecFromUrl method.
The exact error is:
_The function 'webOnlyInstantiateImageCodecFromUrl' isn't defined. Try importing the library that defines 'webOnlyInstantiateImageCodecFromUrl', correcting the name to the name of an existing function, or defining a function named 'webOnlyInstantiateImageCodecFromUrl'._

Any idea to fix that? Thanks a lot

Captura de pantalla 2021-03-09 a las 10 44 10

Configuration

I have a Macbook Air with M1 chipset and this is my flutter doctor:

❯ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.1, on macOS 11.2.2 20D80 darwin-arm, locale es-ES)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] Connected device (2 available)

• No issues found!

Version: Flutter 2.0.1

Platform:

  • [ ] :iphone: iOS
  • [ ] :robot: Android

All 2 comments

Yep, the dart analyzer doesn't understand that function, but it's needed for web. NetworkImage uses the same: https://github.com/flutter/flutter/blob/e605b7c2250e803f46017b1d544fc8c297007546/packages/flutter/lib/src/painting/_network_image_web.dart#L91

If this is really breaking your app please reopen with a more precise problem, but this is nothing I can do about.
I tested it on mobile and web and the package works for me.

@AnnaPS , @mlflutter and @ricardocaste. I'm glad you gave your opinion by downvoting my answer. I'm doing my best maintaining this package in my free time, so apparently I missed something. Do you have better solution? Maybe you can fix the dart analyser and add this method so it recognises the function?

Edit: if you want to help you can at least tell me which platform you are trying to run it on. Is this web or another platform?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chow2324 picture chow2324  ·  4Comments

anass-naoushi picture anass-naoushi  ·  5Comments

nashfive picture nashfive  ·  5Comments

srburton picture srburton  ·  6Comments

port3000 picture port3000  ·  5Comments