Baseflow / flutter_cached_network_image

Download, cache and show images in a flutter app
https://baseflow.com
2.41k stars 638 forks source link

Error when building application for web platform #943

Open mpastuszka opened 2 months ago

mpastuszka commented 2 months ago

🐛 Bug Report

../../../../.pub-cache/hosted/pub.dev/cached_network_image_web-1.2.0/lib/cached_network_image_web.dart:159:12: Error: The method 'createImageCodecFromUrl' isn't defined for the class 'ImageLoader'.

Application builds on version cached_network_image_web-1.1.1 with no problems.

Expected behavior: Application is building on web

Reproduction steps: flutter build web --source-maps --web-renderer html

Configuration:

Flutter 3.13.6 • channel stable • https://github.com/flutter/flutter.git Framework • revision ead455963c (7 months ago) • 2023-09-26 18:28:17 -0700 Engine • revision a794cf2681 Tools • Dart 3.1.3 • DevTools 2.25.0

Version: cached_network_image: 3.3.1 cached_network_image_web: 1.2.0

Platform:

shmink commented 2 months ago

I ran into the same problem on Monday (29/04/2024).

Here's my logs from my pipeline

#16 8.211 Compiling lib/main_web.dart for the Web...                      
#16 41.25 Target dart2js failed: ProcessException: Process exited abnormally:
#16 41.25 ../.pub-cache/hosted/pub.dev/carousel_slider-4.2.1/lib/carousel_slider.dart:358:33:
#16 41.25 Warning: Operand of null-aware operation '?.' has type 'PageStorageBucket' which excludes null.
#16 41.25  - 'PageStorageBucket' is from 'package:flutter/src/widgets/page_storage.dart' ('../fvm/versions/3.13.3/packages/flutter/lib/src/widgets/page_storage.dart').
#16 41.25                     PageStorage.of(storageContext)?.readState(storageContext)
#16 41.25                                 ^
#16 41.25 ../.pub-cache/hosted/pub.dev/cached_network_image_web-1.2.0/lib/cached_network_image_web.dart:159:12:
#16 41.25 Error: The method 'createImageCodecFromUrl' isn't defined for the class 'ImageLoader'.
#16 41.25  - 'ImageLoader' is from 'package:cached_network_image_web/cached_network_image_web.dart' ('../.pub-cache/hosted/pub.dev/cached_network_image_web-1.2.0/lib/cached_network_image_web.dart').
#16 41.25     return createImageCodecFromUrl(
#16 41.25            ^^^^^^^^^^^^^^^^^^^^^^^
#16 41.25 Error: Compilation failed.
#16 41.25   Command: /root/fvm/versions/3.13.3/bin/cache/dart-sdk/bin/dart --disable-dart-dev /root/fvm/versions/3.13.3/bin/cache/dart-sdk/bin/snapshots/dart2js.dart.snapshot --platform-binaries=/root/fvm/versions/3.13.3/bin/cache/flutter_web_sdk/kernel --invoker=flutter_tool -Ddart.vm.product=true -DENVIRONMENT=qa -DFLUTTER_WEB_AUTO_DETECT=false -DFLUTTER_WEB_USE_SKIA=false -DFLUTTER_WEB_CANVASKIT_URL=https://www.gstatic.com/flutter-canvaskit/b8d35810e91ab8fc39ba5e7a41bff6f697e8e3a8/ --native-null-assertions --no-source-maps -o /root/app/.dart_tool/flutter_build/247114a1b1fa7ff2737a4b92070ad05a/app.dill --packages=.dart_tool/package_config.json --cfe-only /root/app/.dart_tool/flutter_build/247114a1b1fa7ff2737a4b92070ad05a/main.dart
#16 41.25 #0      RunResult.throwException (package:flutter_tools/src/base/process.dart:125:5)
#16 41.25 #1      _DefaultProcessUtils.run (package:flutter_tools/src/base/process.dart:278:19)

Locking version to 3.3.0 seems to fix the issue.

cached_network_image: 3.3.0

chenshengfa0803 commented 1 month ago

same issue

lehoangbaochung commented 1 month ago

same energy

Irvan-SSR commented 1 month ago

pub.dev/cached_network_image_web-1.2.0/lib/cached_network_image_web.dart:159:12: Error: The method 'createImageCodecFromUrl' isn't defined for the class 'ImageLoader'. same here

serdarpolat commented 1 month ago

Same here

odedsolutions commented 1 week ago

Guys, checkout @shmink great answer, and make sure you drop the caret

So cached_network_image: 3.3.0 Not cached_network_image: ^3.3.0

zhiwozhewang commented 1 week ago

same issue

MarcBritton commented 6 days ago

We experienced the same thing