flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
162.21k stars 26.65k forks source link

Image.errorBuilder throws exception for invalid image data #107416

Open cybrox opened 1 year ago

cybrox commented 1 year ago

Steps to Reproduce

  1. Create a new flutter project and use this gist as the main.dart
  2. Compile and run on Android or iOS

Expected results: The image should not load (as the image data is invalid) and the errorBuilder should be called instead.

Actual results: App crashes with uncaught exception _Exception (Exception: Invalid image data)

D/skia    (27874): libjpeg error 68 <Unsupported marker type 0x73> from output_message
D/skia    (27874): libjpeg error 68 <Unsupported marker type 0x73> from ReadHeader
E/FlutterJNI(27874): Failed to decode image
E/FlutterJNI(27874): android.graphics.ImageDecoder$DecodeException: Failed to create image decoder with message 'invalid input'Input contained an error.
E/FlutterJNI(27874):    at android.graphics.ImageDecoder.nCreate(Native Method)
E/FlutterJNI(27874):    at android.graphics.ImageDecoder.access$200(ImageDecoder.java:173)
E/FlutterJNI(27874):    at android.graphics.ImageDecoder$ByteBufferSource.createImageDecoder(ImageDecoder.java:250)
E/FlutterJNI(27874):    at android.graphics.ImageDecoder.decodeBitmapImpl(ImageDecoder.java:1847)
E/FlutterJNI(27874):    at android.graphics.ImageDecoder.decodeBitmap(ImageDecoder.java:1840)
E/FlutterJNI(27874):    at io.flutter.embedding.engine.FlutterJNI.decodeImage(FlutterJNI.java:524)
I/ample.img_cras(27874): ProcessProfilingInfo new_methods=851 is saved saved_to_disk=1 resolve_classes_delay=8000
_futurize (dart:ui/painting.dart:5718)
ImageDescriptor.encoded (dart:ui/painting.dart:5574)
instantiateImageCodec (dart:ui/painting.dart:2056)
<asynchronous gap> (Unknown Source:0)
Code sample See gist linked above. Minimal usage is: ```dart Image( image: invalidJpgImageData, width: 640, height: 480, gaplessPlayback: true ) ``` For obtaining an invalid JPEG, use the bytes in the gist or open a JPEG in a hex editor and keep changing bytes until a viewer can no longer open it properly.
Logs ``` [ +49 ms] executing: uname -m [ +21 ms] Exit code 0 from: uname -m [ ] x86_64 [ +4 ms] executing: [/home/sgehring/.asdf/installs/flutter/3.0.1-stable/] git -c log.showSignature=false log -n 1 --pretty=format:%H [ +2 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H [ ] fb57da5f945d02ef4f98dfd9409a72b7cce74268 [ ] executing: [/home/sgehring/.asdf/installs/flutter/3.0.1-stable/] git tag --points-at fb57da5f945d02ef4f98dfd9409a72b7cce74268 [ +7 ms] Exit code 0 from: git tag --points-at fb57da5f945d02ef4f98dfd9409a72b7cce74268 [ ] 3.0.1 [ +5 ms] executing: [/home/sgehring/.asdf/installs/flutter/3.0.1-stable/] git rev-parse --abbrev-ref --symbolic @{u} [ +2 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u} [ ] origin/stable [ ] executing: [/home/sgehring/.asdf/installs/flutter/3.0.1-stable/] git ls-remote --get-url origin [ +1 ms] Exit code 0 from: git ls-remote --get-url origin [ ] https://github.com/flutter/flutter.git [ +55 ms] executing: [/home/sgehring/.asdf/installs/flutter/3.0.1-stable/] git rev-parse --abbrev-ref HEAD [ +2 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD [ ] stable [ +35 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update. [ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update. [ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update. [ +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update. [ +42 ms] executing: /home/sgehring/Android/Sdk/platform-tools/adb devices -l [ +23 ms] List of devices attached 802d5cf6 device usb:1-4 product:beryllium model:POCOPHONE_F1 device:beryllium transport_id:2 [ +4 ms] /home/sgehring/Android/Sdk/platform-tools/adb -s 802d5cf6 shell getprop [ +91 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update. [ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update. [ +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'WindowsUwpEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update. [ +1 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update. [ +82 ms] Skipping pub get: version match. [ +44 ms] Generating /home/sgehring/development/img_crash/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java [ +43 ms] ro.hardware = qcom [ +29 ms] Initializing file store [ +7 ms] Skipping target: gen_localizations [ +4 ms] gen_dart_plugin_registrant: Starting due to {InvalidatedReasonKind.inputChanged: The following inputs have updated contents: /home/sgehring/development/img_crash/.dart_tool/package_config_subset} [ +16 ms] gen_dart_plugin_registrant: Complete [ ] Skipping target: _composite [ +1 ms] complete [ +4 ms] Launching lib/main.dart on POCOPHONE F1 in debug mode... [ +3 ms] /home/sgehring/.asdf/installs/flutter/3.0.1-stable/bin/cache/dart-sdk/bin/dart --disable-dart-dev /home/sgehring/.asdf/installs/flutter/3.0.1-stable/bin/cache/dart-sdk/bin/snapshots/frontend_server.dart.snapshot --sdk-root /home/sgehring/.asdf/installs/flutter/3.0.1-stable/bin/cache/artifacts/engine/common/flutter_patched_sdk/ --incremental --target=flutter --debugger-module-names --experimental-emit-debug-metadata -DFLUTTER_WEB_AUTO_DETECT=true --output-dill /tmp/flutter_tools.OMYSCH/flutter_tool.RGHECU/app.dill --packages /home/sgehring/development/img_crash/.dart_tool/package_config.json -Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts --track-widget-creation --filesystem-scheme org-dartlang-root --initialize-from-dill build/c075001b96339384a97db4862b8ab8db.cache.dill.track.dill --enable-experiment=alternative-invalidation-strategy [ +4 ms] executing: /home/sgehring/Android/Sdk/build-tools/32.0.0/aapt dump xmltree /home/sgehring/development/img_crash/build/app/outputs/flutter-apk/app.apk AndroidManifest.xml [ +2 ms] Exit code 0 from: /home/sgehring/Android/Sdk/build-tools/32.0.0/aapt dump xmltree /home/sgehring/development/img_crash/build/app/outputs/flutter-apk/app.apk AndroidManifest.xml [ ] N: android=http://schemas.android.com/apk/res/android E: manifest (line=2) A: android:versionCode(0x0101021b)=(type 0x10)0x1 A: android:versionName(0x0101021c)="1.0.0" (Raw: "1.0.0") A: android:compileSdkVersion(0x01010572)=(type 0x10)0x1f A: android:compileSdkVersionCodename(0x01010573)="12" (Raw: "12") A: package="com.example.img_crash" (Raw: "com.example.img_crash") A: platformBuildVersionCode=(type 0x10)0x1f A: platformBuildVersionName=(type 0x10)0xc E: uses-sdk (line=7) A: android:minSdkVersion(0x0101020c)=(type 0x10)0x10 A: android:targetSdkVersion(0x01010270)=(type 0x10)0x1f E: uses-permission (line=15) A: android:name(0x01010003)="android.permission.INTERNET" (Raw: "android.permission.INTERNET") E: application (line=17) A: android:label(0x01010001)="img_crash" (Raw: "img_crash") A: android:icon(0x01010002)=@0x7f080000 A: android:name(0x01010003)="android.app.Application" (Raw: "android.app.Application") A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff A: android:appComponentFactory(0x0101057a)="androidx.core.app.CoreComponentFactory" (Raw: "androidx.core.app.CoreComponentFactory") E: activity (line=23) A: android:theme(0x01010000)=@0x7f0a0000 A: android:name(0x01010003)="com.example.img_crash.MainActivity" (Raw: "com.example.img_crash.MainActivity") A: android:exported(0x01010010)=(type 0x12)0xffffffff A: android:launchMode(0x0101001d)=(type 0x10)0x1 A: android:configChanges(0x0101001f)=(type 0x11)0x40003fb4 A: android:windowSoftInputMode(0x0101022b)=(type 0x11)0x10 A: android:hardwareAccelerated(0x010102d3)=(type 0x12)0xffffffff E: meta-data (line=38) A: android:name(0x01010003)="io.flutter.embedding.android.NormalTheme" (Raw: "io.flutter.embedding.android.NormalTheme") A: android:resource(0x01010025)=@0x7f0a0001 E: intent-filter (line=42) E: action (line=43) A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN") E: category (line=45) A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER") E: meta-data (line=52) A: android:name(0x01010003)="flutterEmbedding" (Raw: "flutterEmbedding") A: android:value(0x01010024)=(type 0x10)0x2 E: uses-library (line=56) A: android:name(0x01010003)="androidx.window.extensions" (Raw: "androidx.window.extensions") A: android:required(0x0101028e)=(type 0x12)0x0 E: uses-library (line=59) A: android:name(0x01010003)="androidx.window.sidecar" (Raw: "androidx.window.sidecar") A: android:required(0x0101028e)=(type 0x12)0x0 [ +4 ms] executing: /home/sgehring/Android/Sdk/platform-tools/adb -s 802d5cf6 shell -x logcat -v time -t 1 [ +9 ms] <- compile package:img_crash/main.dart [ +115 ms] --------- beginning of main 07-11 18:12:29.456 E/libc ( 886): Access denied finding property "ro.hardware.fp.sideCap" [ +5 ms] executing: /home/sgehring/Android/Sdk/platform-tools/adb version [ +2 ms] Android Debug Bridge version 1.0.41 Version 31.0.3-7562133 Installed as /home/sgehring/Android/Sdk/platform-tools/adb [ +1 ms] executing: /home/sgehring/Android/Sdk/platform-tools/adb start-server [ +2 ms] Building APK [ +10 ms] Running Gradle task 'assembleDebug'... [ +1 ms] Using gradle from /home/sgehring/development/img_crash/android/gradlew. [ +11 ms] executing: /opt/android-studio/jre/bin/java -version [ +84 ms] Exit code 0 from: /opt/android-studio/jre/bin/java -version [ ] openjdk version "11.0.12" 2021-07-20 OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) OpenJDK 64-Bit Server VM (build 11.0.12+0-b1504.28-7817840, mixed mode) [ ] executing: /opt/android-studio/jre/bin/java -version [ +83 ms] Exit code 0 from: /opt/android-studio/jre/bin/java -version [ ] openjdk version "11.0.12" 2021-07-20 OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) OpenJDK 64-Bit Server VM (build 11.0.12+0-b1504.28-7817840, mixed mode) [ +1 ms] executing: [/home/sgehring/development/img_crash/android/] /home/sgehring/development/img_crash/android/gradlew -Pverbose=true -Ptarget-platform=android-arm64 -Ptarget=/home/sgehring/development/img_crash/lib/main.dart -Pbase-application-name=android.app.Application -Pdart-defines=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ== -Pdart-obfuscation=false -Ptrack-widget-creation=true -Ptree-shake-icons=false -Pfilesystem-scheme=org-dartlang-root assembleDebug [ +696 ms] > Task :app:preBuild UP-TO-DATE [ ] > Task :app:preDebugBuild UP-TO-DATE [ ] > Task :app:mergeDebugNativeDebugMetadata NO-SOURCE [ +94 ms] > Task :app:compileFlutterBuildDebug UP-TO-DATE [ ] > Task :app:packLibsflutterBuildDebug UP-TO-DATE [ ] > Task :app:compileDebugAidl NO-SOURCE [ ] > Task :app:compileDebugRenderscript NO-SOURCE [ ] > Task :app:generateDebugBuildConfig UP-TO-DATE [ ] > Task :app:checkDebugAarMetadata UP-TO-DATE [ ] > Task :app:cleanMergeDebugAssets [ ] > Task :app:mergeDebugShaders UP-TO-DATE [ ] > Task :app:compileDebugShaders NO-SOURCE [ ] > Task :app:generateDebugAssets UP-TO-DATE [ ] > Task :app:mergeDebugAssets [ +198 ms] > Task :app:copyFlutterAssetsDebug [ ] > Task :app:generateDebugResValues UP-TO-DATE [ ] > Task :app:generateDebugResources UP-TO-DATE [ ] > Task :app:mergeDebugResources UP-TO-DATE [ ] > Task :app:createDebugCompatibleScreenManifests UP-TO-DATE [ ] > Task :app:extractDeepLinksDebug UP-TO-DATE [ ] > Task :app:processDebugMainManifest UP-TO-DATE [ ] > Task :app:processDebugManifest UP-TO-DATE [ ] > Task :app:processDebugManifestForPackage UP-TO-DATE [ ] > Task :app:processDebugResources UP-TO-DATE [ ] > Task :app:compileDebugKotlin UP-TO-DATE [ ] > Task :app:javaPreCompileDebug UP-TO-DATE [ ] > Task :app:compileDebugJavaWithJavac UP-TO-DATE [ ] > Task :app:processDebugJavaRes NO-SOURCE [ +98 ms] > Task :app:mergeDebugJavaResource UP-TO-DATE [ ] > Task :app:checkDebugDuplicateClasses UP-TO-DATE [ ] > Task :app:dexBuilderDebug UP-TO-DATE [ ] > Task :app:desugarDebugFileDependencies UP-TO-DATE [ ] > Task :app:mergeExtDexDebug UP-TO-DATE [ ] > Task :app:mergeDexDebug UP-TO-DATE [ ] > Task :app:mergeDebugJniLibFolders UP-TO-DATE [ ] > Task :app:mergeDebugNativeLibs UP-TO-DATE [ ] > Task :app:stripDebugDebugSymbols UP-TO-DATE [ ] > Task :app:validateSigningDebug UP-TO-DATE [ ] > Task :app:writeDebugAppMetadata UP-TO-DATE [ ] > Task :app:writeDebugSigningConfigVersions UP-TO-DATE [ +398 ms] > Task :app:compressDebugAssets [ ] Execution optimizations have been disabled for task ':app:compressDebugAssets' to ensure correctness due to the following reasons: [ ] - Gradle detected a problem with the following location: '/home/sgehring/development/img_crash/build/app/intermediates/assets/debug/mergeDebugAssets'. Reason: Task ':app:compressDebugAssets' uses this output of task ':app:copyFlutterAssetsDebug' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.4/userguide/validation_problems.html#implicit_dependency for more details about this problem. [ ] > Task :app:packageDebug UP-TO-DATE [ ] > Task :app:createDebugApkListingFileRedirect UP-TO-DATE [ +226 ms] > Task :app:assembleDebug [ ] Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0. [ ] You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. [ ] See https://docs.gradle.org/7.4/userguide/command_line_interface.html#sec:command_line_warnings [ ] Execution optimizations have been disabled for 1 invalid unit(s) of work during this build to ensure correctness. [ ] Please consult deprecation warnings for more details. [ ] BUILD SUCCESSFUL in 1s [ ] 35 actionable tasks: 5 executed, 30 up-to-date [ +322 ms] Running Gradle task 'assembleDebug'... (completed in 2,220ms) [ +241 ms] calculateSha: LocalDirectory: '/home/sgehring/development/img_crash/build/app/outputs/flutter-apk'/app.apk [ +797 ms] ✓ Built build/app/outputs/flutter-apk/app-debug.apk. [ +1 ms] executing: /home/sgehring/Android/Sdk/build-tools/32.0.0/aapt dump xmltree /home/sgehring/development/img_crash/build/app/outputs/flutter-apk/app.apk AndroidManifest.xml [ +4 ms] Exit code 0 from: /home/sgehring/Android/Sdk/build-tools/32.0.0/aapt dump xmltree /home/sgehring/development/img_crash/build/app/outputs/flutter-apk/app.apk AndroidManifest.xml [ ] N: android=http://schemas.android.com/apk/res/android E: manifest (line=2) A: android:versionCode(0x0101021b)=(type 0x10)0x1 A: android:versionName(0x0101021c)="1.0.0" (Raw: "1.0.0") A: android:compileSdkVersion(0x01010572)=(type 0x10)0x1f A: android:compileSdkVersionCodename(0x01010573)="12" (Raw: "12") A: package="com.example.img_crash" (Raw: "com.example.img_crash") A: platformBuildVersionCode=(type 0x10)0x1f A: platformBuildVersionName=(type 0x10)0xc E: uses-sdk (line=7) A: android:minSdkVersion(0x0101020c)=(type 0x10)0x10 A: android:targetSdkVersion(0x01010270)=(type 0x10)0x1f E: uses-permission (line=15) A: android:name(0x01010003)="android.permission.INTERNET" (Raw: "android.permission.INTERNET") E: application (line=17) A: android:label(0x01010001)="img_crash" (Raw: "img_crash") A: android:icon(0x01010002)=@0x7f080000 A: android:name(0x01010003)="android.app.Application" (Raw: "android.app.Application") A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff A: android:appComponentFactory(0x0101057a)="androidx.core.app.CoreComponentFactory" (Raw: "androidx.core.app.CoreComponentFactory") E: activity (line=23) A: android:theme(0x01010000)=@0x7f0a0000 A: android:name(0x01010003)="com.example.img_crash.MainActivity" (Raw: "com.example.img_crash.MainActivity") A: android:exported(0x01010010)=(type 0x12)0xffffffff A: android:launchMode(0x0101001d)=(type 0x10)0x1 A: android:configChanges(0x0101001f)=(type 0x11)0x40003fb4 A: android:windowSoftInputMode(0x0101022b)=(type 0x11)0x10 A: android:hardwareAccelerated(0x010102d3)=(type 0x12)0xffffffff E: meta-data (line=38) A: android:name(0x01010003)="io.flutter.embedding.android.NormalTheme" (Raw: "io.flutter.embedding.android.NormalTheme") A: android:resource(0x01010025)=@0x7f0a0001 E: intent-filter (line=42) E: action (line=43) A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN") E: category (line=45) A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER") E: meta-data (line=52) A: android:name(0x01010003)="flutterEmbedding" (Raw: "flutterEmbedding") A: android:value(0x01010024)=(type 0x10)0x2 E: uses-library (line=56) A: android:name(0x01010003)="androidx.window.extensions" (Raw: "androidx.window.extensions") A: android:required(0x0101028e)=(type 0x12)0x0 E: uses-library (line=59) A: android:name(0x01010003)="androidx.window.sidecar" (Raw: "androidx.window.sidecar") A: android:required(0x0101028e)=(type 0x12)0x0 [ +1 ms] Stopping app 'app.apk' on POCOPHONE F1. [ ] executing: /home/sgehring/Android/Sdk/platform-tools/adb -s 802d5cf6 shell am force-stop com.example.img_crash [ +141 ms] executing: /home/sgehring/Android/Sdk/platform-tools/adb -s 802d5cf6 shell pm list packages com.example.img_crash [ +53 ms] package:com.example.img_crash [ +1 ms] executing: /home/sgehring/Android/Sdk/platform-tools/adb -s 802d5cf6 shell cat /data/local/tmp/sky.com.example.img_crash.sha1 [ +23 ms] 16d353da7378d840781083f4c42d771bb650501a [ ] Latest build already installed. [ ] executing: /home/sgehring/Android/Sdk/platform-tools/adb -s 802d5cf6 shell -x logcat -v time -t 1 [ +58 ms] --------- beginning of main 07-11 18:12:34.791 E/libc ( 886): Access denied finding property "ro.hardware.fp.sideCap" [ +5 ms] executing: /home/sgehring/Android/Sdk/platform-tools/adb -s 802d5cf6 shell am start -a android.intent.action.RUN -f 0x20000000 --ez enable-dart-profiling true --ez enable-checked-mode true --ez verify-entry-points true com.example.img_crash/com.example.img_crash.MainActivity [ +39 ms] Starting: Intent { act=android.intent.action.RUN flg=0x20000000 cmp=com.example.img_crash/.MainActivity (has extras) } [ ] Waiting for observatory port to be available... [ +304 ms] Observatory URL on device: http://127.0.0.1:37563/uysnDNSNtz0=/ [ ] executing: /home/sgehring/Android/Sdk/platform-tools/adb -s 802d5cf6 forward tcp:0 tcp:37563 [ +4 ms] 40351 [ ] Forwarded host port 40351 to device port 37563 for Observatory [ +3 ms] Caching compiled dill [ +93 ms] Connecting to service protocol: http://127.0.0.1:40351/uysnDNSNtz0=/ [ +188 ms] Launching a Dart Developer Service (DDS) instance at http://127.0.0.1:0, connecting to VM service at http://127.0.0.1:40351/uysnDNSNtz0=/. [ +206 ms] DDS is listening at http://127.0.0.1:42901/urd1gqU3ucg=/. [ +38 ms] Successfully connected to service protocol: http://127.0.0.1:40351/uysnDNSNtz0=/ [ +55 ms] DevFS: Creating new filesystem on the device (null) [ +66 ms] DevFS: Created new filesystem on the device (file:///data/user/0/com.example.img_crash/code_cache/img_crashSIMNBV/img_crash/) [ +1 ms] Updating assets [ +45 ms] Syncing files to device POCOPHONE F1... [ ] <- reset [ ] Compiling dart to kernel with 0 updated files [ ] Processing bundle. [ ] <- recompile package:img_crash/main.dart 484060f0-4e1a-4bec-89d8-53221a5adbf7 [ ] <- 484060f0-4e1a-4bec-89d8-53221a5adbf7 [ ] Bundle processing done. [ +45 ms] Updating files. [ ] DevFS: Sync finished [ ] Syncing files to device POCOPHONE F1... (completed in 48ms) [ ] Synced 0.0MB. [ +1 ms] <- accept [ +2 ms] Connected to _flutterView/0x75873e5620. [ +1 ms] Flutter run key commands. [ ] r Hot reload. 🔥🔥🔥 [ ] R Hot restart. [ ] h List all available interactive commands. [ ] d Detach (terminate "flutter run" but leave application running). [ ] c Clear the screen [ ] q Quit (terminate the application on the device). [ ] 💪 Running with sound null safety 💪 [ ] An Observatory debugger and profiler on POCOPHONE F1 is available at: http://127.0.0.1:42901/urd1gqU3ucg=/ [ +342 ms] D/skia (28012): libjpeg error 68 from output_message [ ] D/skia (28012): libjpeg error 68 from ReadHeader [ ] E/FlutterJNI(28012): Failed to decode image [ ] E/FlutterJNI(28012): android.graphics.ImageDecoder$DecodeException: Failed to create image decoder with message 'invalid input'Input contained an error. [ ] E/FlutterJNI(28012): at android.graphics.ImageDecoder.nCreate(Native Method) [ ] E/FlutterJNI(28012): at android.graphics.ImageDecoder.access$200(ImageDecoder.java:173) [ ] E/FlutterJNI(28012): at android.graphics.ImageDecoder$ByteBufferSource.createImageDecoder(ImageDecoder.java:250) [ ] E/FlutterJNI(28012): at android.graphics.ImageDecoder.decodeBitmapImpl(ImageDecoder.java:1847) [ ] E/FlutterJNI(28012): at android.graphics.ImageDecoder.decodeBitmap(ImageDecoder.java:1840) [ ] E/FlutterJNI(28012): at io.flutter.embedding.engine.FlutterJNI.decodeImage(FlutterJNI.java:524) [ +32 ms] I/flutter (28012): Error builder called! [ +211 ms] W/Gralloc3(28012): mapper 3.x is not supported [ +4 ms] The Flutter DevTools debugger and profiler on POCOPHONE F1 is available at: http://127.0.0.1:9102?uri=http://127.0.0.1:42901/urd1gqU3ucg=/ [+5336 ms] Application finished. ``` ``` Analyzing img_crash... info • The value of the field '_counter' isn't used • lib/main.dart:52:7 • unused_field info • Avoid `print` calls in production code • lib/main.dart:6947:11 • avoid_print 2 issues found. (ran in 1.6s) ``` ``` [✓] Flutter (Channel stable, 3.0.1, on Arch Linux 5.18.9-arch1-1, locale en_US.UTF-8) • Flutter version 3.0.1 at /home/sgehring/.asdf/installs/flutter/3.0.1-stable • Upstream repository https://github.com/flutter/flutter.git • Framework revision fb57da5f94 (8 weeks ago), 2022-05-19 15:50:29 -0700 • Engine revision caaafc5604 • Dart version 2.17.1 • DevTools version 2.12.2 [✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0) • Android SDK at /home/sgehring/Android/Sdk • Platform android-32, build-tools 32.0.0 • Java binary at: /opt/android-studio/jre/bin/java • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) • All Android licenses accepted. [✓] Chrome - develop for the web • CHROME_EXECUTABLE = /usr/bin/chrome [✓] Linux toolchain - develop for Linux desktop • clang version 14.0.6 • cmake version 3.23.2 • ninja version 1.11.0 • pkg-config version 1.8.0 [✓] Android Studio (version 2021.1) • Android Studio at /opt/android-studio • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) [✓] Connected device (3 available) • POCOPHONE F1 (mobile) • 802d5cf6 • android-arm64 • Android 10 (API 29) • Linux (desktop) • linux • linux-x64 • Arch Linux 5.18.9-arch1-1 • Chrome (web) • chrome • web-javascript • Chromium 103.0.5060.114 Arch Linux [✓] HTTP Host Availability • All required HTTP hosts are available • No issues found! ```

Why is this an issue? We use Image for displaying (M)JPEG streams fetched from cameras. Due to network issues or encoding errors in cheap devices, the app sometimes receives invalid JPEG frames that we would like to discard safely.

Thank you for maintaining Flutter. I searched for this in the open issues but could not find anything that looks like the same issue.

maheshmnj commented 1 year ago

Hi @cybrox, Thanks for filing the issue. I am able to reproduce the issue on the latest stable channel but not on the master channel. So I believe this is fixed on the master channel. You can verify this by switching to the master channel by running

flutter channel master
flutter upgrade

output from master

logs ``` Restarted application in 831ms. D/skia (22579): libjpeg error 68 from output_message D/skia (22579): libjpeg error 68 from ReadHeader E/FlutterJNI(22579): Failed to decode image E/FlutterJNI(22579): android.graphics.ImageDecoder$DecodeException: Failed to create image decoder with message 'invalid input'Input contained an error. E/FlutterJNI(22579): at android.graphics.ImageDecoder.nCreate(Native Method) E/FlutterJNI(22579): at android.graphics.ImageDecoder.access$200(ImageDecoder.java:173) E/FlutterJNI(22579): at android.graphics.ImageDecoder$ByteBufferSource.createImageDecoder(ImageDecoder.java:250) E/FlutterJNI(22579): at android.graphics.ImageDecoder.decodeBitmapImpl(ImageDecoder.java:1862) E/FlutterJNI(22579): at android.graphics.ImageDecoder.decodeBitmap(ImageDecoder.java:1855) E/FlutterJNI(22579): at io.flutter.embedding.engine.FlutterJNI.decodeImage(FlutterJNI.java:524) I/flutter (22579): Error builder called! ```
code sample ```dart import 'package:flutter/material.dart'; import 'dart:typed_data'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, ), home: const MyHomePage(title: 'Flutter Demo Home Page'), ); } } class MyHomePage extends StatefulWidget { const MyHomePage({Key? key, required this.title}) : super(key: key); final String title; @override State createState() => _MyHomePageState(); } class _MyHomePageState extends State { int _counter = 0; void _incrementCounter() { setState(() { _counter++; }); } @override Widget build(BuildContext context) { final Uint8List imgDataErr = Uint8List.fromList([ 255,216,255,115,0,16,74,70,73,70,0,1,1,1,1,44,1,44,0,0,255,254,0,19,67,114,101,97,116,101,100,32,119,105,116,104,32,71,73,77,80,255,226,2,176,73,67,67,95,80,82,79,70,73,76,69,0,1,1,0,0,2,160,108,99,109,115,4,48,0,0,109,110,116,114,82,71,66,32,88,89,90,32,7,230,0,7,0,11,0,9,0,42,0,45,97,99,115,112,65,80,80,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,246,214,0,1,0,0,0,0,211,45,108,99,109,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,100,101,115,99,0,0,1,32,0,0,0,64,99,112,114,116,0,0,1,96,0,0,0,54,119,116,112,116,0,0,1,152,0,0,0,20,99,104,97,100,0,0,1,172,0,0,0,44,114,88,89,90,0,0,1,216,0,0,0,20,98,88,89,90,0,0,1,236,0,0,0,20,103,88,89,90,0,0,2,0,0,0,0,20,114,84,82,67,0,0,2,20,0,0,0,32,103,84,82,67,0,0,2,20,0,0,0,32,98,84,82,67,0,0,2,20,0,0,0,32,99,104,114,109,0,0,2,52,0,0,0,36,100,109,110,100,0,0,2,88,0,0,0,36,100,109,100,100,0,0,2,124,0,0,0,36,109,108,117,99,0,0,0,0,0,0,0,1,0,0,0,12,101,110,85,83,0,0,0,36,0,0,0,28,0,71,0,73,0,77,0,80,0,32,0,98,0,117,0,105,0,108,0,116,0,45,0,105,0,110,0,32,0,115,0,82,0,71,0,66,109,108,117,99,0,0,0,0,0,0,0,1,0,0,0,12,101,110,85,83,0,0,0,26,0,0,0,28,0,80,0,117,0,98,0,108,0,105,0,99,0,32,0,68,0,111,0,109,0,97,0,105,0,110,0,0,88,89,90,32,0,0,0,0,0,0,246,214,0,1,0,0,0,0,211,45,115,102,51,50,0,0,0,0,0,1,12,66,0,0,5,222,255,255,243,37,0,0,7,147,0,0,253,144,255,255,251,161,255,255,253,162,0,0,3,220,0,0,192,110,88,89,90,32,0,0,0,0,0,0,111,160,0,0,56,245,0,0,3,144,88,89,90,32,0,0,0,0,0,0,36,159,0,0,15,132,0,0,182,196,88,89,90,32,0,0,0,0,0,0,98,151,0,0,183,135,0,0,24,217,112,97,114,97,0,0,0,0,0,3,0,0,0,2,102,102,0,0,242,167,0,0,13,89,0,0,19,208,0,0,10,91,99,104,114,109,0,0,0,0,0,3,0,0,0,0,163,215,0,0,84,124,0,0,76,205,0,0,153,154,0,0,38,103,0,0,15,92,109,108,117,99,0,0,0,0,0,0,0,1,0,0,0,12,101,110,85,83,0,0,0,8,0,0,0,28,0,71,0,73,0,77,0,80,109,108,117,99,0,0,0,0,0,0,0,1,0,0,0,12,101,110,85,83,0,0,0,8,0,0,0,28,0,115,0,82,0,71,0,66,255,219,0,67,0,3,2,2,3,2,2,3,3,3,3,4,3,3,4,5,8,5,5,4,4,5,10,7,7,6,8,12,10,12,12,11,10,11,11,13,14,18,16,13,14,17,14,11,11,16,22,16,17,19,20,21,21,21,12,15,23,24,22,20,24,18,20,21,20,255,219,0,67,1,3,4,4,5,4,5,9,5,5,9,20,13,11,13,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,255,194,0,17,8,1,224,2,128,3,1,17,0,2,17,1,3,17,1,255,196,0,27,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,8,6,7,3,5,4,2,255,196,0,26,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,5,4,3,1,2,6,255,218,0,12,3,1,0,2,16,3,16,0,0,1,196,93,252,216,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,235,231,191,95,227,239,195,223,62,87,223,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,236,124,116,165,229,217,216,241,239,52,239,154,87,173,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,198,125,52,164,203,31,83,231,236,97,251,230,149,235,68,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,147,21,30,241,62,151,246,247,9,223,54,243,134,156,63,124,210,189,104,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,36,218,221,115,38,239,205,239,147,141,41,31,179,207,170,46,109,108,63,124,210,189,104,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,27,252,218,232,73,213,102,106,145,178,189,184,117,204,84,40,73,245,48,253,243,74,245,162,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,111,61,241,247,193,215,177,80,160,167,212,195,247,205,43,214,136,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,123,21,10,10,125,76,63,124,210,189,104,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,215,177,80,160,167,212,195,247,205,43,214,136,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,123,21,10,10,125,76,63,124,210,189,104,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,215,177,80,160,167,212,195,247,205,43,214,136,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,123,21,10,10,125,76,63,124,210,189,104,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,215,177,80,160,167,212,195,247,205,43,214,136,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,123,21,10,10,125,76,63,124,210,189,104,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,215,177,80,160,167,212,195,247,205,43,214,136,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,123,21,10,10,125,76,63,124,210,189,104,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,215,177,80,160,167,212,195,247,205,43,214,136,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,123,21,10,10,125,76,63,124,210,189,104,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,209,178,236,236,88,247,229,123,112,224,52,37,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,196,0,35,16,0,0,5,5,1,0,2,3,0,0,0,0,0,0,0,0,0,3,4,5,6,2,7,53,54,96,1,16,160,17,21,22,255,218,0,8,1,1,0,1,5,2,251,91,148,115,100,25,250,39,32,115,82,212,197,241,141,109,42,94,20,176,70,83,49,22,38,186,207,23,29,138,168,125,173,185,181,59,82,111,137,174,179,197,70,160,245,30,40,46,146,168,247,223,41,241,12,156,183,87,225,53,214,120,152,100,105,37,9,66,149,37,35,38,79,48,49,223,219,115,79,229,232,77,117,158,38,37,35,245,149,91,163,210,86,132,143,210,37,47,199,11,111,147,19,93,103,138,48,227,13,249,182,249,17,53,214,120,219,111,145,19,93,103,141,182,249,17,53,214,120,219,111,145,19,93,103,141,182,249,17,53,214,120,219,111,145,19,93,103,141,182,249,17,53,214,120,219,111,145,19,93,103,141,182,249,17,53,214,120,219,111,145,19,93,103,141,182,249,17,53,53,120,219,111,145,19,93,103,141,132,187,37,104,91,253,171,48,148,74,27,28,88,190,204,223,255,196,0,40,17,0,1,3,4,1,3,2,7,0,0,0,0,0,0,0,0,1,2,3,4,16,49,51,96,0,17,18,33,19,160,20,34,50,65,66,81,82,255,218,0,8,1,3,1,1,63,1,247,91,129,215,192,231,166,191,231,133,10,30,72,211,80,218,156,61,7,26,101,45,82,70,35,166,52,193,115,207,219,137,72,64,232,43,35,17,210,217,141,249,46,169,120,45,125,169,164,140,71,74,142,202,64,239,161,32,121,60,122,65,95,202,155,114,39,214,105,35,17,210,152,123,211,61,13,184,181,165,3,169,227,175,23,77,33,220,210,70,35,165,146,77,235,14,230,146,49,29,58,29,205,36,98,58,116,59,154,72,196,116,232,119,52,145,136,233,208,238,105,35,17,211,161,220,210,70,35,167,67,185,164,140,71,78,135,115,73,24,142,157,14,230,146,49,29,58,29,205,36,98,58,116,59,154,72,196,116,232,119,52,145,136,233,209,156,75,100,247,115,226,26,253,241,231,144,182,200,7,220,207,255,196,0,37,17,0,1,3,4,2,1,4,3,0,0,0,0,0,0,0,0,1,2,3,16,4,49,51,96,0,17,18,19,33,81,160,50,65,113,255,218,0,8,1,2,1,1,63,1,251,91,247,213,249,234,35,231,129,105,54,58,106,214,16,59,60,113,210,228,49,144,105,142,58,17,253,226,148,84,123,50,198,65,165,186,255,0,233,18,166,138,81,228,97,140,131,74,121,213,19,227,0,119,236,56,211,62,30,230,252,169,252,97,140,131,74,121,191,49,216,191,18,130,179,208,227,109,134,226,166,194,24,200,52,190,186,154,155,8,99,32,211,170,108,33,140,131,78,169,176,134,50,13,58,166,194,24,200,52,234,155,8,99,32,211,170,108,33,140,131,78,169,176,134,50,13,58,166,194,24,200,52,234,155,8,99,32,211,170,108,33,140,131,78,169,176,134,50,13,58,166,194,24,200,52,231,208,165,129,227,207,65,207,142,52,210,210,176,72,251,51,255,0,255,196,0,56,16,0,1,2,2,7,5,5,4,11,0,0,0,0,0,0,0,1,2,4,3,16,0,18,96,115,130,178,193,17,19,49,65,113,5,33,34,81,97,35,50,160,161,20,36,52,53,66,82,98,147,163,209,225,255,218,0,8,1,1,0,6,63,2,248,173,194,33,160,173,103,130,82,54,147,79,187,221,126,202,168,98,69,102,226,20,49,197,75,132,64,22,55,114,217,21,143,53,114,79,90,109,79,181,114,71,138,49,210,79,48,103,22,48,44,251,22,128,247,197,60,250,80,64,109,12,33,31,51,214,111,48,103,22,45,46,123,69,37,16,248,166,7,51,214,129,8,72,74,71,112,3,149,54,158,225,79,161,181,241,64,134,130,165,69,252,199,211,210,79,48,103,22,42,23,104,41,73,115,25,125,233,242,135,254,201,81,99,44,67,134,158,42,85,20,221,182,216,76,254,113,58,210,49,242,128,115,38,79,48,103,22,43,119,20,253,82,41,241,126,147,231,77,252,104,157,199,220,74,120,175,165,54,196,53,32,167,220,132,56,9,58,185,212,73,230,12,226,197,166,186,212,186,162,170,107,30,2,110,174,181,147,204,25,197,142,117,117,172,158,96,206,44,115,171,173,100,243,6,113,99,157,93,107,39,152,51,139,28,234,235,89,60,193,156,88,231,87,90,201,230,12,226,199,58,186,214,79,48,103,22,57,213,214,178,121,131,56,177,206,174,181,147,204,25,197,142,117,117,172,158,96,206,44,115,171,173,100,243,6,113,99,157,93,107,39,152,51,139,28,225,110,226,238,146,168,123,1,170,79,63,74,125,179,248,151,253,81,203,118,238,119,145,151,87,98,106,40,126,33,233,241,51,255,0,255,196,0,37,16,0,1,2,5,3,4,3,0,0,0,0,0,0,0,0,0,1,17,96,0,65,81,161,177,33,49,97,16,113,145,193,129,160,240,255,218,0,8,1,1,0,1,63,33,251,91,145,103,161,162,56,2,63,29,234,19,188,59,167,32,82,69,89,160,19,185,180,21,74,80,54,0,132,46,189,168,12,238,84,139,64,158,3,51,206,194,3,33,106,76,218,148,203,55,148,88,158,225,26,115,210,56,223,180,8,67,161,160,10,1,7,4,0,10,73,216,65,2,84,218,136,9,242,111,60,178,249,6,180,228,168,148,87,199,64,31,245,49,0,130,112,49,67,47,80,113,230,40,59,49,156,172,161,17,54,190,248,237,9,204,70,164,47,225,56,212,43,106,254,67,83,207,64,212,102,174,66,136,196,194,30,33,65,214,207,139,67,155,62,45,14,108,248,180,57,179,226,208,230,207,139,67,155,62,45,14,108,248,180,57,179,226,208,230,207,139,67,155,62,45,14,108,248,180,57,179,226,208,230,108,78,196,160,200,122,115,82,72,89,12,117,32,54,7,236,207,255,218,0,12,3,1,0,2,0,3,0,0,0,16,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,97,115,100,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,255,0,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,172,155,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,108,252,155,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,97,199,155,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,120,40,155,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,101,246,155,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,111,178,155,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,178,155,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,178,155,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,178,155,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,178,155,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,178,155,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,178,155,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,178,155,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,178,155,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,178,155,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,178,155,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,178,155,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,211,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,219,109,182,255,196,0,38,17,0,1,4,2,1,3,3,5,0,0,0,0,0,0,0,0,1,16,17,96,177,0,161,33,81,97,209,49,145,160,65,113,193,225,240,255,218,0,8,1,3,1,1,63,16,249,91,144,216,115,157,247,177,192,238,64,251,24,107,65,192,28,114,122,165,91,16,206,109,199,87,140,110,108,22,173,136,91,141,236,249,241,128,0,24,33,143,48,3,213,42,216,133,3,185,201,210,1,36,97,143,60,22,193,228,237,249,9,86,196,43,172,205,119,97,115,100,206,73,192,232,154,105,86,196,45,144,19,178,233,132,171,98,29,166,18,173,136,118,152,74,182,33,218,97,42,216,135,105,132,171,98,29,166,18,173,136,118,152,74,182,33,218,97,42,216,135,105,132,171,98,29,166,18,173,136,118,152,74,182,33,218,97,42,216,135,16,9,159,63,168,62,49,248,196,183,208,245,29,190,76,255,0,255,196,0,97,115,100,1,3,4,2,0,7,1,0,0,0,0,0,0,0,0,1,16,96,177,0,17,33,161,49,81,65,97,113,145,160,209,240,193,255,218,0,8,1,2,1,1,63,16,249,91,144,11,149,133,121,31,113,68,44,2,125,89,183,51,68,179,129,210,72,130,204,199,140,254,115,87,51,114,178,32,178,236,223,222,250,162,73,55,41,226,36,158,18,68,22,81,135,16,54,132,59,23,52,31,23,10,44,71,159,240,164,136,44,174,97,115,100,80,108,100,246,155,201,34,11,44,5,214,28,174,242,72,130,206,222,73,16,89,219,201,34,11,59,121,36,65,103,111,36,136,44,237,228,145,5,157,188,146,32,179,183,146,68,22,118,242,72,130,206,222,73,16,89,219,201,34,11,59,121,36,65,103,0,2,246,175,192,143,186,198,155,61,117,242,103,255,196,0,38,16,1,0,2,1,2,5,4,3,1,0,0,0,0,0,0,0,1,17,33,65,0,49,16,81,96,97,129,113,145,160,161,144,177,193,209,255,218,0,8,1,1,0,1,63,16,249,91,246,119,106,164,2,175,99,134,61,254,110,232,16,32,74,2,93,208,232,215,215,68,170,239,165,125,184,23,85,117,32,111,185,253,101,185,90,142,141,222,130,49,99,22,221,232,121,18,144,214,133,213,193,189,226,115,125,8,0,232,221,196,128,21,104,12,234,103,12,79,102,153,61,235,56,37,235,227,204,32,5,1,203,72,124,203,192,27,171,131,84,143,28,144,79,178,95,114,34,137,232,198,228,249,177,18,77,194,221,164,86,201,76,186,164,224,104,63,171,176,22,180,106,200,4,90,89,135,135,207,144,72,42,41,238,193,250,122,51,120,251,115,123,0,93,168,6,246,180,26,3,26,162,114,72,25,185,147,144,25,83,67,88,170,187,142,78,94,92,216,1,142,2,230,144,247,255,0,14,141,220,158,24,10,59,78,209,45,21,249,195,227,191,29,248,239,199,126,59,241,223,142,252,119,227,191,29,248,239,199,120,187,166,34,68,40,161,183,134,94,52,195,221,153,10,183,28,254,76,255,0,255,217 ]); final imageData = MemoryImage(imgDataErr); return Scaffold( appBar: AppBar( title: Text(widget.title), ), body: Center( child: Image( image: imageData, width: 640, height: 480, gaplessPlayback: true, errorBuilder: ( BuildContext context, Object error, StackTrace? stackTrace, ) { return Text("Error builder called!"); }, )), floatingActionButton: FloatingActionButton( onPressed: _incrementCounter, tooltip: 'Increment', child: const Icon(Icons.add), ), ); } } ```
flutter doctor -v (mac) ``` [✓] Flutter (Channel stable, 3.0.4, on macOS 12.4 21F79 darwin-arm, locale en-IN) • Flutter version 3.0.4 at /Users/mahesh/Documents/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 85684f9300 (4 days ago), 2022-06-30 13:22:47 -0700 • Engine revision 6ba2af10bb • Dart version 2.17.5 • DevTools version 2.12.2 [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc4) • Android SDK at /Users/mahesh/Library/Android/sdk • Platform android-32, build-tools 33.0.0-rc4 • ANDROID_HOME = /Users/mahesh/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 13.2.1) • Xcode at /Applications/Xcode.app/Contents/Developer • CocoaPods version 1.11.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2021.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) [✓] IntelliJ IDEA Community Edition (version 2021.2.1) • IntelliJ at /Applications/IntelliJ IDEA CE.app • Flutter plugin version 61.2.4 • Dart plugin version 212.5080.8 [✓] VS Code (version 1.67.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.44.0 [✓] Connected device (3 available) • sdk gphone arm64 (mobile) • emulator-5554 • android-arm64 • Android 11 (API 30) (emulator) • macOS (desktop) • macos • darwin-arm64 • macOS 12.4 21F79 darwin-arm • Chrome (web) • chrome • web-javascript • Google Chrome 103.0.5060.53 [✓] HTTP Host Availability • All required HTTP hosts are available • No issues found! ``` ``` Could not load custom device from config index 0: Expected enabled to be a boolean. [✓] Flutter (Channel master, 3.1.0-0.0.pre.1594, on macOS 12.4 21F79 darwin-arm, locale en-IN) • Flutter version 3.1.0-0.0.pre.1594 on channel master at /Users/mahesh/Documents/flutter_master • Upstream repository https://github.com/flutter/flutter.git • Framework revision 082ad11422 (21 hours ago), 2022-07-11 11:40:07 +0200 • Engine revision 2b5d5c3b2d • Dart version 2.18.0 (build 2.18.0-271.0.dev) • DevTools version 2.15.0 [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc4) • Android SDK at /Users/mahesh/Library/Android/sdk • Platform android-32, build-tools 33.0.0-rc4 • ANDROID_HOME = /Users/mahesh/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 13.2.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 13C100 • CocoaPods version 1.11.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2021.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) [✓] IntelliJ IDEA Community Edition (version 2021.2.1) • IntelliJ at /Applications/IntelliJ IDEA CE.app • Flutter plugin version 61.2.4 • Dart plugin version 212.5080.8 [✓] VS Code (version 1.67.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.44.0 [✓] Connected device (3 available) • sdk gphone arm64 (mobile) • emulator-5554 • android-arm64 • Android 11 (API 30) (emulator) • macOS (desktop) • macos • darwin-arm64 • macOS 12.4 21F79 darwin-arm • Chrome (web) • chrome • web-javascript • Google Chrome 103.0.5060.114 [✓] HTTP Host Availability • All required HTTP hosts are available • No issues found! ```
cybrox commented 1 year ago

Hi @maheshmnj, thanks for the reply! I tried running it using Flutter from the master channel and the error builder is shown correctly. However, I still get an uncaught exception.

https://i.imgur.com/sCuBeR8.png

When I originally got this, I did not worry about it too much, as in all of our tests, it seemed like the application would recover from it. However, we have been getting feedback from users and crash reports from production via crashlytics now.

https://i.imgur.com/BW8kqbG.png

I tested with the following setup:

Flutter 3.1.0-0.0.pre.1630 • channel master • https://github.com/flutter/flutter.git
Framework • revision 803ef6a456 (2 hours ago) • 2022-07-13 11:07:59 +0200
Engine • revision 20038216ac
Tools • Dart 2.18.0 (build 2.18.0-272.0.dev) • DevTools 2.15.0
flutter doctor -v ``` [✓] Flutter (Channel master, 3.1.0-0.0.pre.1630, on Arch Linux 5.18.9-arch1-1, locale en_US.UTF-8) • Flutter version 3.1.0-0.0.pre.1630 on channel master at /home/sgehring/development/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 803ef6a456 (2 hours ago), 2022-07-13 11:07:59 +0200 • Engine revision 20038216ac • Dart version 2.18.0 (build 2.18.0-272.0.dev) • DevTools version 2.15.0 [✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0) • Android SDK at /home/sgehring/Android/Sdk • Platform android-32, build-tools 32.0.0 • Java binary at: /opt/android-studio/jre/bin/java • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) • All Android licenses accepted. [✓] Chrome - develop for the web • CHROME_EXECUTABLE = /usr/bin/chrome [✓] Linux toolchain - develop for Linux desktop • clang version 14.0.6 • cmake version 3.23.2 • ninja version 1.11.0 • pkg-config version 1.8.0 [✓] Android Studio (version 2021.1) • Android Studio at /opt/android-studio • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) [✓] Connected device (3 available) • POCOPHONE F1 (mobile) • 802d5cf6 • android-arm64 • Android 10 (API 29) • Linux (desktop) • linux • linux-x64 • Arch Linux 5.18.9-arch1-1 • Chrome (web) • chrome • web-javascript • Chromium 103.0.5060.114 Arch Linux [✓] HTTP Host Availability • All required HTTP hosts are available • No issues found! ```
maheshmnj commented 1 year ago

Thanks for the confirmation @cybrox I do get the error in the console too and the error Widget is shown as expected. Code sample https://github.com/flutter/flutter/issues/107416#issuecomment-1181384556

To summarize

logs ``` Launching lib/main.dart on sdk gphone arm64 in debug mode... ✓ Built build/app/outputs/flutter-apk/app-debug.apk. Connecting to VM Service at ws://127.0.0.1:54551/hyzWwHGn2PA=/ws D/skia (10052): libjpeg error 68 from output_message D/skia (10052): libjpeg error 68 from ReadHeader E/FlutterJNI(10052): Failed to decode image E/FlutterJNI(10052): android.graphics.ImageDecoder$DecodeException: Failed to create image decoder with message 'invalid input'Input contained an error. E/FlutterJNI(10052): at android.graphics.ImageDecoder.nCreate(Native Method) E/FlutterJNI(10052): at android.graphics.ImageDecoder.access$200(ImageDecoder.java:173) E/FlutterJNI(10052): at android.graphics.ImageDecoder$ByteBufferSource.createImageDecoder(ImageDecoder.java:250) E/FlutterJNI(10052): at android.graphics.ImageDecoder.decodeBitmapImpl(ImageDecoder.java:1862) E/FlutterJNI(10052): at android.graphics.ImageDecoder.decodeBitmap(ImageDecoder.java:1855) E/FlutterJNI(10052): at io.flutter.embedding.engine.FlutterJNI.decodeImage(FlutterJNI.java:524) ```
flutter doctor -v (mac) ``` [✓] Flutter (Channel stable, 3.0.5, on macOS 12.4 21F79 darwin-arm, locale en-IN) • Flutter version 3.0.5 at /Users/mahesh/Documents/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision f1875d570e (12 hours ago), 2022-07-13 11:24:16 -0700 • Engine revision e85ea0e79c • Dart version 2.17.6 • DevTools version 2.12.2 [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc4) • Android SDK at /Users/mahesh/Library/Android/sdk • Platform android-32, build-tools 33.0.0-rc4 • ANDROID_HOME = /Users/mahesh/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 13.2.1) • Xcode at /Applications/Xcode.app/Contents/Developer • CocoaPods version 1.11.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2021.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) [✓] IntelliJ IDEA Community Edition (version 2021.2.1) • IntelliJ at /Applications/IntelliJ IDEA CE.app • Flutter plugin version 61.2.4 • Dart plugin version 212.5080.8 [✓] VS Code (version 1.67.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.44.0 [✓] Connected device (3 available) • sdk gphone arm64 (mobile) • emulator-5554 • android-arm64 • Android 11 (API 30) (emulator) • macOS (desktop) • macos • darwin-arm64 • macOS 12.4 21F79 darwin-arm • Chrome (web) • chrome • web-javascript • Google Chrome 103.0.5060.114 [✓] HTTP Host Availability • All required HTTP hosts are available • No issues found!``` ``` [✓] Flutter (Channel master, 3.1.0-0.0.pre.1594, on macOS 12.4 21F79 darwin-arm, locale en-IN) • Flutter version 3.1.0-0.0.pre.1594 on channel master at /Users/mahesh/Documents/flutter_master • Upstream repository https://github.com/flutter/flutter.git • Framework revision 082ad11422 (2 days ago), 2022-07-11 11:40:07 +0200 • Engine revision 2b5d5c3b2d • Dart version 2.18.0 (build 2.18.0-271.0.dev) • DevTools version 2.15.0 [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc4) • Android SDK at /Users/mahesh/Library/Android/sdk • Platform android-32, build-tools 33.0.0-rc4 • ANDROID_HOME = /Users/mahesh/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 13.2.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 13C100 • CocoaPods version 1.11.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2021.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) [✓] IntelliJ IDEA Community Edition (version 2021.2.1) • IntelliJ at /Applications/IntelliJ IDEA CE.app • Flutter plugin version 61.2.4 • Dart plugin version 212.5080.8 [✓] VS Code (version 1.67.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.44.0 [✓] Connected device (3 available) • Redmi K20 Pro (mobile) • 192.168.1.2:5555 • android-arm64 • Android 11 (API 30) • macOS (desktop) • macos • darwin-arm64 • macOS 12.4 21F79 darwin-arm • Chrome (web) • chrome • web-javascript • Google Chrome 103.0.5060.114 [✓] HTTP Host Availability • All required HTTP hosts are available • No issues found! ```
WingCH commented 1 year ago

Any update? Thanks I found a temporary solution Just filter manualy in FlutterError.onError

FlutterError.onError = (FlutterErrorDetails details) {
      if (details.library == 'image resource service') {
        return;
      }
      FirebaseCrashlytics.instance.recordFlutterFatalError(details);
    };
msisinni commented 1 year ago

Anyone who uses Bugsnag for error reporting might be experiencing this error without realizing it, because certain variations of the errors from Image lead to the Bugsnag library itself throwing an unrelated StateError. Here's the issue tracking that for Bugsnag https://github.com/bugsnag/bugsnag-flutter/issues/186. A workaround for Bugsnag is adding filtering to bugsnag.start


  await bugsnag.start(
    onError: [
      (BugsnagEvent event) {
        event.errors.removeWhere(
          (BugsnagError error) {
            if (error.errorClass == 'HttpException' || error.errorClass == 'SocketException') {
              return error.stacktrace.isEmpty;
            }
            return false;
          },
        );

        return event.errors.isNotEmpty;
      },
    ],
dmrickey commented 1 year ago

Can we please get a fix where the error isn't uncaught? That's literally what the ErrorBuilder is for (or can we at least have the fix on stable if this already exists in master)

ahmadjz commented 10 months ago

I've been facing this issue for about a year now, and it hasn't been solved yet. It is still throwing an uncaught exception, even though I'm using the imageErrorBuilder.

ramtinq commented 10 months ago

Getting this error too whenever the URI does not exist, with or without errorBuilder.

rodrifting commented 10 months ago

Same goes if you try to load an image with an invalid extension. EXCEPTION UNCAUGHT

Widget build(BuildContext context) {
    try {
      return CachedNetworkImage(
        fit: BoxFit.fitHeight,
        imageUrl: imageUrl!,
        imageBuilder: (context, imageProvider) {
          return Container(
            width: 40.0,
            height: 40.0,
            decoration: BoxDecoration(
              shape: BoxShape.circle,
              image: DecorationImage(image: imageProvider),
            ),
          );
        },
        placeholder: (context, url) => const CircularProgressIndicator(),
        errorWidget: (context, url, error) => const Icon(Icons.error),
      );
    } on Error catch (e) {
      return const Icon(PhosphorIcons.alien_bold);
    } catch (e) {
      if (e is ArgumentError &&
          e.toString().contains('No host specified in URI')) {
        print('Invalid image URL: ${imageUrl}');
        return const Icon(PhosphorIcons.x_circle_bold);
      } else {
        print('Error loading image: $e');
        return const Icon(PhosphorIcons.x_bold);
      }
    }
  }
dzziwny commented 10 months ago

I made a patch to flutter stable branch, to prevent throwing errors for debug mode. To use it:

  1. find your local flutter repo with where flutter - navigate there
  2. copy patch file there
  3. run git apply stop_images_throwing.patch

its actually simple change in two files:

image

image

stop_images_throwing.patch

dmrickey commented 10 months ago

Seriously, how is it acceptable to just throw errors that are already known/handled and not fix it for over year?

Gyarados commented 9 months ago

Still facing this issue in stable version 3.10.6.

Peetee06 commented 8 months ago

Facing this issue as well on channel stable 3.13.2. Trying to load an image without an internet connection on the device throws an uncaught exception even with errorBuilder.

Edit: Everything works fine on channel master 3.14.0-14.0.pre.116

LampeMW commented 6 months ago

Facing this issue as well on channel stable 3.13.2. Trying to load an image without an internet connection on the device throws an uncaught exception even with errorBuilder.

Edit: Everything works fine on channel master 3.14.0-14.0.pre.116

Can confirm that beta channel does not have the issue for me either.

samarthagarwal commented 6 months ago

Any information on when this is going to land in stable channel?

maheshmnj commented 6 months ago

Changes that have landed in beta will show up in next stable release of flutter for more details see flutter build release channels

mateusfccp commented 5 months ago

Changes that have landed in beta will show up in next stable release of flutter for more details see flutter build release channels

Doesn't this means that it should be available on latest stable (3.16.x)? If so, is this issue solved?

ddzy commented 4 months ago

guys, any progress?

c-seeger commented 3 months ago

Still running into this:

try {
    image = Image.network(
        '${Config.imageAPI.url}/v1/image/$imageID?type=profile',
        errorBuilder: (c, o, s) {
      return Images.noImage;
    }).image;
} catch (e) {
  image = Images.noImage.image;
}

our image-api returns a 4xx error but it's not catched neither by errorBuilder nor using the try catch block around

══╡ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE ╞════════════════════════════════════════════════════
Error: HTTP request failed, statusCode: 400,
<invalid image url>
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 294:3       throw_
packages/flutter/src/painting/_network_image_web.dart 146:11                      <fn>
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 574:37  _checkAndCall
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 579:39  dcall
The following ProgressEvent$ object was thrown resolving an image codec:
  [object ProgressEvent]

When the exception was thrown, this was the stack

Image provider:
  NetworkImage("<invalid image url>",
  scale: 1.0)
Image key:
  NetworkImage("<invalid image url>",
  scale: 1.0)
════════════════════════════════════════════════════════════════════════════════════════════════════
Tysonpower commented 2 months ago

Also still have the same issue on Flutter (Channel stable, 3.19.0) ... any way to catch this error?

c-seeger commented 2 months ago

Also still have the same issue on Flutter (Channel stable, 3.19.0) ... any way to catch this error?

The workaround we currently use (which is quite heavy and ugly) is to encapsulate the image in a FutureBuilder making a normal http.get request against the image and catching the error in the http request and on success let Image.network do it's job.

Feels ugly since for every image we need to do the get request, also caching behavior may change, but at least it does not throw random errors that may stop the app from working.

c-seeger commented 1 month ago

@maheshmnj what release version is expected to contain a valid fix?

ZaneCode6574 commented 2 weeks ago

I'm sure this problem is still there. I'm using 3.19.6, even I have errorBuilder in my Image.network widget, it will still throw the exception.

Fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: SocketException: Connection timed out (OS Error: Connection timed out, errno = 110), address = MYADDRESS, port = 42108. Error thrown resolving an image codec.

anasboyka commented 2 days ago

same here still got the same problem... only sometimes the image load correctly..