Skip to content

Navigating to a new page causes the Image errorBuilder to be ignored. #97077

Closed

Description

@MartenM

Hey there! Ran into this issue and been stuck at it for a while now. Created a little sample project and the issue remains.
Not sure what's going on here. Any help is appreciated but I fear it's a bug with flutter itself.

Due to the nature of the images, a 404 can be returned. This is no problem, attach an errorBuilder! The problem arises when I try to push a new route. For some reason, the error now is no longer being handled properly.

Let me know if you need anything else, or if I should post this issue somewhere else!

Steps to Reproduce

Create a new project. Add the following code:

import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      initialRoute: '/',
      routes: {
        '/': (context) => const HomePage(),
        '/test': (context) => const AnotherPage(),
      },
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text('Some test app'),
        ),
        body: Column(
          children: [
            _somePicture('https://docs.flutter.dev/assets/images/shared/brand/flutter/logo/flutter-lockup.png'),
            _somePicture('https://docs.flutter.dev/assets/invalid'),
            SizedBox(height: 20),
            ElevatedButton(onPressed: () => {
              Navigator.pushNamed(context, '/test')
            }, child: Text("Another page"))
          ],
        )
    );
  }

  Widget _somePicture(String input) {
    return Image.network(input, errorBuilder: (a, b, c) {
      return const Text("Error loading image!"); 
    });
  }
}

class AnotherPage extends StatelessWidget {
  const AnotherPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text('Some test app'),
        ),
        body: const Center(child: Text("Second page"))
    );
  }
}
  1. Execute flutter run on the code sample
  2. Click on the button to go to the next page.
  3. Watch the error appear in the console.

Expected results:
No error, because an errorBuilder is provided. This works fine when the widget is loaded.

Actual results:
The application throws an error. No visible errors in the app.

======== Exception caught by image resource service ================================================
The following NetworkImageLoadException was thrown resolving an image codec:
HTTP request failed, statusCode: 404, https://docs.flutter.dev/assets/invalid

When the exception was thrown, this was the stack: 
#0      NetworkImage._loadAsync (package:flutter/src/painting/_network_image_io.dart:100:9)
<asynchronous suspension>
Image provider: NetworkImage("https://docs.flutter.dev/assets/invalid", scale: 1.0)
Image key: NetworkImage("https://docs.flutter.dev/assets/invalid", scale: 1.0)
====================================================================================================
Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      initialRoute: '/',
      routes: {
        '/': (context) => const HomePage(),
        '/test': (context) => const AnotherPage(),
      },
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text('Some test app'),
        ),
        body: Column(
          children: [
            _somePicture('https://docs.flutter.dev/assets/images/shared/brand/flutter/logo/flutter-lockup.png'),
            _somePicture('https://docs.flutter.dev/assets/invalid'),
            SizedBox(height: 20),
            ElevatedButton(onPressed: () => {
              Navigator.pushNamed(context, '/test')
            }, child: Text("Another page"))
          ],
        )
    );
  }

  Widget _somePicture(String input) {
    return Image.network(input, errorBuilder: (a, b, c) {
      return const Text("Error loading image!"); 
    });
  }
}

class AnotherPage extends StatelessWidget {
  const AnotherPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text('Some test app'),
        ),
        body: const Center(child: Text("Second page"))
    );
  }
}


Logs
Microsoft Windows [Version 10.0.19043.1466]
(c) Microsoft Corporation. Alle rechten voorbehouden.

C:\Users\Marten\StudioProjects\test_drive_debug>flutter run --verbose
[  +81 ms] executing: [C:\src\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[  +96 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] 77d935af4db863f6abd0b9c31c7e6df2a13de57b
[        ] executing: [C:\src\flutter/] git tag --points-at 77d935af4db863f6abd0b9c31c7e6df2a13de57b
[ +155 ms] Exit code 0 from: git tag --points-at 77d935af4db863f6abd0b9c31c7e6df2a13de57b
[   +1 ms] 2.8.1
[   +9 ms] executing: [C:\src\flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[  +61 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/stable
[        ] executing: [C:\src\flutter/] git ls-remote --get-url origin
[  +51 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[ +139 ms] executing: [C:\src\flutter/] git rev-parse --abbrev-ref HEAD
[  +58 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[  +78 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[   +1 ms] 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.
[   +5 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.
[  +67 ms] executing: C:\Users\Marten\AppData\Local\Android\sdk\platform-tools\adb.exe devices -l
[  +69 ms] List of devices attached
           emulator-5554          device product:sdk_gphone_x86 model:sdk_gphone_x86 device:generic_x86_arm transport_id:2
[   +9 ms] C:\Users\Marten\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell getprop
[  +58 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[   +4 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.
[  +93 ms] Skipping pub get: version match.
[ +128 ms] Generating C:\Users\Marten\StudioProjects\test_drive_debug\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java
[  +62 ms] ro.hardware = ranchu
[  +18 ms] Using hardware rendering with device sdk gphone x86. If you notice graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
[  +28 ms] Initializing file store
[  +16 ms] Skipping target: gen_localizations
[   +8 ms] gen_dart_plugin_registrant: Starting due to {InvalidatedReasonKind.inputChanged: The following inputs have updated contents: C:\Users\Marten\StudioProjects\test_drive_debug\.dart_tool\package_config_subset}
[  +33 ms] gen_dart_plugin_registrant: Complete
[   +2 ms] Skipping target: _composite
[   +3 ms] complete
[   +6 ms] Launching lib\main.dart on sdk gphone x86 in debug mode...
[   +6 ms] C:\src\flutter\bin\cache\dart-sdk\bin\dart.exe --disable-dart-dev C:\src\flutter\bin\cache\artifacts\engine\windows-x64\frontend_server.dart.snapshot --sdk-root
C:\src\flutter\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
C:\Users\Marten\AppData\Local\Temp\flutter_tools.28bdf3c5\flutter_tool.2057a33a\app.dill --packages C:\Users\Marten\StudioProjects\test_drive_debug\.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
[  +13 ms] executing: C:\Users\Marten\AppData\Local\Android\sdk\build-tools\32.0.0\aapt dump xmltree C:\Users\Marten\StudioProjects\test_drive_debug\build\app\outputs\flutter-apk\app.apk AndroidManifest.xml
[  +15 ms] Exit code 0 from: C:\Users\Marten\AppData\Local\Android\sdk\build-tools\32.0.0\aapt dump xmltree C:\Users\Marten\StudioProjects\test_drive_debug\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="nl.martenm.test_drive_debug" (Raw: "nl.martenm.test_drive_debug")
               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=14)
                 A: android:name(0x01010003)="android.permission.INTERNET" (Raw: "android.permission.INTERNET")
               E: application (line=16)
                 A: android:label(0x01010001)="test_drive_debug" (Raw: "test_drive_debug")
                 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=22)
                   A: android:theme(0x01010000)=@0x7f0a0000
                   A: android:name(0x01010003)="nl.martenm.test_drive_debug.MainActivity" (Raw: "nl.martenm.test_drive_debug.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=37)
                     A: android:name(0x01010003)="io.flutter.embedding.android.NormalTheme" (Raw: "io.flutter.embedding.android.NormalTheme")
                     A: android:resource(0x01010025)=@0x7f0a0001
                   E: intent-filter (line=41)
                     E: action (line=42)
                       A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
                     E: category (line=44)
                       A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")
                 E: meta-data (line=51)
                   A: android:name(0x01010003)="flutterEmbedding" (Raw: "flutterEmbedding")
                   A: android:value(0x01010024)=(type 0x10)0x2
[   +9 ms] executing: C:\Users\Marten\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell -x logcat -v time -t 1
[  +22 ms] <- compile package:test_drive_debug/main.dart
[  +97 ms] --------- beginning of main
           01-22 22:29:34.214 D/BoundBrokerSvc( 1655): onUnbind: Intent { act=com.google.android.gms.feedback.internal.IFeedbackService cmp=com.google.android.gms/.chimera.GmsBoundBrokerService }
[  +12 ms] executing: C:\Users\Marten\AppData\Local\Android\sdk\platform-tools\adb.exe version
[  +69 ms] Android Debug Bridge version 1.0.41
           Version 31.0.3-7562133
           Installed as C:\Users\Marten\AppData\Local\Android\sdk\platform-tools\adb.exe
[   +1 ms] executing: C:\Users\Marten\AppData\Local\Android\sdk\platform-tools\adb.exe start-server
[  +33 ms] Building APK
[  +25 ms] Running Gradle task 'assembleDebug'...
[   +6 ms] Using gradle from C:\Users\Marten\StudioProjects\test_drive_debug\android\gradlew.bat.
[  +25 ms] executing: C:\Program Files\Android\Android Studio\jre\bin\java -version
[ +148 ms] Exit code 0 from: C:\Program Files\Android\Android Studio\jre\bin\java -version
[        ] openjdk version "11.0.10" 2021-01-19
           OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
           OpenJDK 64-Bit Server VM (build 11.0.10+0-b96-7249189, mixed mode)
[   +2 ms] executing: [C:\Users\Marten\StudioProjects\test_drive_debug\android/] C:\Users\Marten\StudioProjects\test_drive_debug\android\gradlew.bat -Pverbose=true -Ptarget-platform=android-x86
-Ptarget=C:\Users\Marten\StudioProjects\test_drive_debug\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
[+3805 ms] > Task :app:compileFlutterBuildDebug
[   +1 ms] [  +94 ms] executing: [C:\src\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] [ +134 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[        ] [   +1 ms] 77d935af4db863f6abd0b9c31c7e6df2a13de57b
[        ] [        ] executing: [C:\src\flutter/] git tag --points-at 77d935af4db863f6abd0b9c31c7e6df2a13de57b
[   +1 ms] [  +87 ms] Exit code 0 from: git tag --points-at 77d935af4db863f6abd0b9c31c7e6df2a13de57b
[        ] [        ] 2.8.1
[        ] [   +8 ms] executing: [C:\src\flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[        ] [  +56 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] [        ] origin/stable
[        ] [        ] executing: [C:\src\flutter/] git ls-remote --get-url origin
[        ] [  +49 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] [        ] https://github.com/flutter/flutter.git
[        ] [  +66 ms] executing: [C:\src\flutter/] git rev-parse --abbrev-ref HEAD
[        ] [  +55 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] [        ] stable
[        ] [  +81 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[   +1 ms] [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[   +1 ms] [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] [   +4 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.
[   +1 ms] [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[        ] [ +125 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[        ] [   +4 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[   +1 ms] [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +2 ms] [        ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[        ] [        ] 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.
[   +1 ms] [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[   +1 ms] [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[   +1 ms] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[   +1 ms] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'PubDependencies' is not required, skipping update.
[        ] [  +61 ms] Initializing file store
[        ] [  +40 ms] Skipping target: gen_localizations
[        ] [  +17 ms] gen_dart_plugin_registrant: Starting due to {InvalidatedReasonKind.inputChanged: The following inputs have updated contents: C:\Users\Marten\StudioProjects\test_drive_debug\.dart_tool\package_config_subset}
[   +2 ms] [  +52 ms] gen_dart_plugin_registrant: Complete
[        ] [   +4 ms] kernel_snapshot: Starting due to {}
[        ] [  +13 ms] C:\src\flutter\bin\cache\dart-sdk\bin\dart.exe --disable-dart-dev C:\src\flutter\bin\cache\artifacts\engine\windows-x64\frontend_server.dart.snapshot --sdk-root
C:\src\flutter\bin\cache\artifacts\engine\common\flutter_patched_sdk/ --target=flutter --no-print-incremental-dependencies -DFLUTTER_WEB_AUTO_DETECT=true -Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts
--track-widget-creation --no-link-platform --packages C:\Users\Marten\StudioProjects\test_drive_debug\.dart_tool\package_config.json --output-dill
C:\Users\Marten\StudioProjects\test_drive_debug\.dart_tool\flutter_build\e7b5ea91e920f10fa48839059d5a5f16\app.dill --depfile
C:\Users\Marten\StudioProjects\test_drive_debug\.dart_tool\flutter_build\e7b5ea91e920f10fa48839059d5a5f16\kernel_snapshot.d package:test_drive_debug/main.dart
[+11046 ms] [+11195 ms] kernel_snapshot: Complete
[ +595 ms] [ +574 ms] debug_android_application: Starting due to {}
[ +295 ms] [ +279 ms] debug_android_application: Complete
[ +700 ms] [ +697 ms] Persisting file store
[   +1 ms] [  +11 ms] Done persisting file store
[        ] [  +12 ms] build succeeded.
[        ] [  +18 ms] "flutter assemble" took 13.144ms.
[ +105 ms] [  +89 ms] ensureAnalyticsSent: 82ms
[   +1 ms] [   +1 ms] Running shutdown hooks
[   +1 ms] [        ] Shutdown hooks complete
[   +1 ms] [        ] exiting with code 0
[ +198 ms] > Task :app:packLibsflutterBuildDebug UP-TO-DATE
[   +1 ms] > Task :app:preBuild UP-TO-DATE
[        ] > Task :app:preDebugBuild UP-TO-DATE
[        ] > Task :app:compileDebugAidl NO-SOURCE
[        ] > Task :app:compileDebugRenderscript NO-SOURCE
[  +90 ms] > Task :app:generateDebugBuildConfig UP-TO-DATE
[   +1 ms] > 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
[  +87 ms] > Task :app:mergeDebugAssets
[ +316 ms] > Task :app:copyFlutterAssetsDebug
[   +4 ms] > Task :app:generateDebugResValues UP-TO-DATE
[  +14 ms] > Task :app:generateDebugResources UP-TO-DATE
[   +1 ms] > 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
[  +64 ms] > Task :app:compileDebugKotlin UP-TO-DATE
[   +1 ms] > Task :app:javaPreCompileDebug UP-TO-DATE
[        ] > Task :app:compileDebugJavaWithJavac UP-TO-DATE
[        ] > Task :app:compileDebugSources UP-TO-DATE
[        ] > Task :app:mergeDebugNativeDebugMetadata NO-SOURCE
[        ] > Task :app:processDebugJavaRes NO-SOURCE
[ +109 ms] > Task :app:mergeDebugJavaResource UP-TO-DATE
[ +108 ms] > Task :app:checkDebugDuplicateClasses UP-TO-DATE
[   +1 ms] > Task :app:dexBuilderDebug UP-TO-DATE
[  +89 ms] > Task :app:desugarDebugFileDependencies UP-TO-DATE
[  +86 ms] > Task :app:mergeExtDexDebug UP-TO-DATE
[   +1 ms] > Task :app:mergeDexDebug UP-TO-DATE
[   +1 ms] > Task :app:mergeDebugJniLibFolders UP-TO-DATE
[        ] > Task :app:mergeDebugNativeLibs UP-TO-DATE
[        ] > Task :app:stripDebugDebugSymbols UP-TO-DATE
[        ] > Task :app:validateSigningDebug UP-TO-DATE
[ +496 ms] > Task :app:compressDebugAssets
[+1105 ms] > Task :app:packageDebug
[  +93 ms] > Task :app:assembleDebug
[   +1 ms] Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
[        ] Use '--warning-mode all' to show the individual deprecation warnings.
[        ] See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings
[        ] BUILD SUCCESSFUL in 19s
[        ] 32 actionable tasks: 7 executed, 25 up-to-date
[ +588 ms] Running Gradle task 'assembleDebug'... (completed in 20,3s)
[ +305 ms] calculateSha: LocalDirectory: 'C:\Users\Marten\StudioProjects\test_drive_debug\build\app\outputs\flutter-apk'/app.apk
[ +916 ms] √  Built build\app\outputs\flutter-apk\app-debug.apk.
[ +153 ms] executing: C:\Users\Marten\AppData\Local\Android\sdk\build-tools\32.0.0\aapt dump xmltree C:\Users\Marten\StudioProjects\test_drive_debug\build\app\outputs\flutter-apk\app.apk AndroidManifest.xml
[  +69 ms] Exit code 0 from: C:\Users\Marten\AppData\Local\Android\sdk\build-tools\32.0.0\aapt dump xmltree C:\Users\Marten\StudioProjects\test_drive_debug\build\app\outputs\flutter-apk\app.apk AndroidManifest.xml
[   +1 ms] 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="nl.martenm.test_drive_debug" (Raw: "nl.martenm.test_drive_debug")
               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=14)
                 A: android:name(0x01010003)="android.permission.INTERNET" (Raw: "android.permission.INTERNET")
               E: application (line=16)
                 A: android:label(0x01010001)="test_drive_debug" (Raw: "test_drive_debug")
                 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=22)
                   A: android:theme(0x01010000)=@0x7f0a0000
                   A: android:name(0x01010003)="nl.martenm.test_drive_debug.MainActivity" (Raw: "nl.martenm.test_drive_debug.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=37)
                     A: android:name(0x01010003)="io.flutter.embedding.android.NormalTheme" (Raw: "io.flutter.embedding.android.NormalTheme")
                     A: android:resource(0x01010025)=@0x7f0a0001
                   E: intent-filter (line=41)
                     E: action (line=42)
                       A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
                     E: category (line=44)
                       A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")
                 E: meta-data (line=51)
                   A: android:name(0x01010003)="flutterEmbedding" (Raw: "flutterEmbedding")
                   A: android:value(0x01010024)=(type 0x10)0x2
[   +3 ms] Stopping app 'app.apk' on sdk gphone x86.
[   +1 ms] executing: C:\Users\Marten\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell am force-stop nl.martenm.test_drive_debug
[  +61 ms] executing: C:\Users\Marten\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell pm list packages nl.martenm.test_drive_debug
[  +66 ms] package:nl.martenm.test_drive_debug
[   +2 ms] executing: C:\Users\Marten\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell cat /data/local/tmp/sky.nl.martenm.test_drive_debug.sha1
[  +43 ms] a1cd30557b943161c12e82afd7f263227fb45e91
[   +1 ms] Installing APK.
[   +2 ms] Installing build\app\outputs\flutter-apk\app.apk...
[        ] executing: C:\Users\Marten\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 install -t -r C:\Users\Marten\StudioProjects\test_drive_debug\build\app\outputs\flutter-apk\app.apk
[+1307 ms] Performing Streamed Install
                    Success
[   +3 ms] Installing build\app\outputs\flutter-apk\app.apk... (completed in 1.309ms)
[   +1 ms] executing: C:\Users\Marten\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell echo -n 215ac098071df6772d1bebe9ac4102ff05c53d5e > /data/local/tmp/sky.nl.martenm.test_drive_debug.sha1
[  +41 ms] executing: C:\Users\Marten\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell -x logcat -v time -t 1
[ +147 ms] --------- beginning of system
                    01-22 22:30:27.474 W/BroadcastQueue(  532): Background execution not allowed: receiving Intent { act=android.intent.action.PACKAGE_ADDED dat=package:nl.martenm.test_drive_debug flg=0x4000010 (has extras) } to
                    com.android.vending/com.google.android.finsky.packagemanager.impl.PackageMonitorReceiverImpl$RegisteredReceiver
[   +9 ms] executing: C:\Users\Marten\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 shell am start -a android.intent.action.RUN -f 0x20000000 --ez enable-background-compilation true --ez enable-dart-profiling
true --ez enable-checked-mode true --ez verify-entry-points true nl.martenm.test_drive_debug/nl.martenm.test_drive_debug.MainActivity
[ +160 ms] Starting: Intent { act=android.intent.action.RUN flg=0x20000000 cmp=nl.martenm.test_drive_debug/.MainActivity (has extras) }
[   +2 ms] Waiting for observatory port to be available...
[+2677 ms] Observatory URL on device: http://127.0.0.1:37535/0ls1TsoopH4=/
[   +1 ms] executing: C:\Users\Marten\AppData\Local\Android\sdk\platform-tools\adb.exe -s emulator-5554 forward tcp:0 tcp:37535
[  +27 ms] 60521
[        ] Forwarded host port 60521 to device port 37535 for Observatory
[   +6 ms] Caching compiled dill
[  +33 ms] Connecting to service protocol: http://127.0.0.1:60521/0ls1TsoopH4=/
[ +534 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:60521/0ls1TsoopH4=/.
[ +269 ms] DDS is listening at http://127.0.0.1:60525/TRto_B5UBUk=/.
[  +76 ms] Successfully connected to service protocol: http://127.0.0.1:60521/0ls1TsoopH4=/
[ +168 ms] DevFS: Creating new filesystem on the device (null)
[  +81 ms] DevFS: Created new filesystem on the device (file:///data/user/0/nl.martenm.test_drive_debug/code_cache/test_drive_debugYGXGTB/test_drive_debug/)
[   +2 ms] Updating assets
[ +114 ms] Syncing files to device sdk gphone x86...
[   +3 ms] <- reset
[        ] Compiling dart to kernel with 0 updated files
[   +3 ms] <- recompile package:test_drive_debug/main.dart 166edf2d-d5f2-4fd1-9eeb-4f4d287ed002
[        ] <- 166edf2d-d5f2-4fd1-9eeb-4f4d287ed002
[ +297 ms] Updating files.
[        ] DevFS: Sync finished
[        ] Syncing files to device sdk gphone x86... (completed in 305ms)
[        ] Synced 0.0MB.
[   +2 ms] <- accept
[   +4 ms] Connected to _flutterView/0xee6c96e0.
[   +2 ms] Flutter run key commands.
[   +2 ms] r Hot reload. 
[   +1 ms] 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 
[   +2 ms] An Observatory debugger and profiler on sdk gphone x86 is available at: http://127.0.0.1:60525/TRto_B5UBUk=/
[+2706 ms] The Flutter DevTools debugger and profiler on sdk gphone x86 is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:60525/TRto_B5UBUk=/
[+3511 ms]
                    ══╡ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE ╞════════════════════════════════════════════════════
                    The following NetworkImageLoadException was thrown resolving an image codec:
                    HTTP request failed, statusCode: 404, https://docs.flutter.dev/assets/invalid
                    
                    When the exception was thrown, this was the stack:
                    #0      NetworkImage._loadAsync (package:flutter/src/painting/_network_image_io.dart:100:9)
                    <asynchronous suspension>
                    
                    Image provider: NetworkImage("https://docs.flutter.dev/assets/invalid", scale: 1.0)
                    Image key: NetworkImage("https://docs.flutter.dev/assets/invalid", scale: 1.0)
                    ════════════════════════════════════════════════════════════════════════════════════════════════════

Analyzing test_drive_debug...
No issues found! (ran in 1.8s)
[√] Flutter (Channel stable, 2.8.1, on Microsoft Windows [Version 10.0.19043.1466], locale nl-NL)
    • Flutter version 2.8.1 at C:\src\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 77d935af4d (5 weeks ago), 2021-12-16 08:37:33 -0800
    • Engine revision 890a5fca2e
    • Dart version 2.15.1

[√] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    • Android SDK at C:\Users\Marten\AppData\Local\Android\sdk
    • Platform android-32, build-tools 32.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 2020.3)
    • Android Studio at C:\Program Files\Android\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.10+0-b96-7249189)

[√] IntelliJ IDEA Community Edition (version 2017.3)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.3.2
    • 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

[√] IntelliJ IDEA Ultimate Edition (version 2019.2)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2019.2.3
    • 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

[√] Connected device (3 available)
    • sdk gphone x86 (mobile) • emulator-5554 • android-x86    • Android 11 (API 30) (emulator)
    • Chrome (web)            • chrome        • web-javascript • Google Chrome 97.0.4692.71
    • Edge (web)              • edge          • web-javascript • Microsoft Edge 96.0.1054.62

• No issues found!

Activity

  1. MartenM commented on Jan 23, 2022

    @MartenM
    Author

    Seems related to the following issue #69125 and #34451.

  2. changed the title [-]Navigator.pushNamed() causes the Image errorBuilder to be ignored.[/-] [+]Navigating to a new page causes the Image errorBuilder to be ignored.[/+] on Jan 24, 2022
  3. danagbemava-nc commented on Jan 24, 2022

    @danagbemava-nc
    Member

    Issue is reproducible using sample provided above.

    Observations

    • The errorBuilder works as expected on the first page
    • Navigating (without clearing the stack) to the second page causes the issue to reproduce (Navigator.push(...)/Navigator.pushNamed(...))
    • The issue doesn't reproduce if you clear the stack during navigation (Navigator.pushReplacement(...)/Navigator.pushReplacementNamed(...) )
    • This is likely related to Pages on Navigator stack rebuild when a new page is pushed #11655
    code sample
    import 'package:flutter/material.dart';
    
    void main() {
      runApp(const MyApp());
    }
    
    class MyApp extends StatelessWidget {
      const MyApp({Key? key}) : super(key: key);
    
      // This widget is the root of your application.
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Flutter Demo',
          theme: ThemeData(
            primarySwatch: Colors.blue,
          ),
          initialRoute: '/',
          routes: {
            '/': (context) => const HomePage(),
            '/test': (context) => const AnotherPage(),
          },
        );
      }
    }
    
    class HomePage extends StatelessWidget {
      const HomePage({Key? key}) : super(key: key);
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(
            title: const Text('Some test app'),
          ),
          body: Column(
            children: [
              const SomePicture(
                  input:
                      'https://docs.flutter.dev/assets/images/shared/brand/flutter/logo/flutter-lockup.png'),
              const SomePicture(input: 'https://docs.flutter.dev/assets/invalid'),
              const SizedBox(height: 20),
              ElevatedButton(
                onPressed: () => Navigator.pushNamed(context, '/test'),
                // onPressed: () => Navigator.pushReplacement(context,
                // MaterialPageRoute(builder: (context) => const AnotherPage())),
                child: const Text("Another page"),
              )
            ],
          ),
        );
      }
    }
    
    class SomePicture extends StatelessWidget {
      final String input;
    
      const SomePicture({required this.input, Key? key}) : super(key: key);
    
      @override
      Widget build(BuildContext context) {
        return Image.network(input, errorBuilder: (a, b, c) {
          return const Text("Error loading image!");
        });
      }
    }
    
    class AnotherPage extends StatelessWidget {
      const AnotherPage({Key? key}) : super(key: key);
    
      @override
      Widget build(BuildContext context) {
        print("+================================================+");
        print("+========== ON Second page ==========+");
        print("+================================================+");
        return Scaffold(
          appBar: AppBar(
            title: const Text('Some test app'),
          ),
          body: const Center(
            child: Text("Second page"),
          ),
        );
      }
    }
    
    logs

    run_verbose.txt

    flutter doctor -v
    [✓] Flutter (Channel stable, 2.8.1, on macOS 11.6 20G165 darwin-arm, locale en-GB)
        • Flutter version 2.8.1 at /Users/nexus/dev/sdks/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 77d935af4d (6 weeks ago), 2021-12-16 08:37:33 -0800
        • Engine revision 890a5fca2e
        • Dart version 2.15.1
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
        • Android SDK at /Users/nexus/Library/Android/sdk
        • Platform android-31, build-tools 31.0.0
        • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 13.0)
        • 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 2020.3)
        • 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.10+0-b96-7249189)
    
    [☠] IntelliJ IDEA Community Edition (the doctor check crashed)
        ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know about this issue at https://github.com/flutter/flutter/issues.
        ✗ FormatException: Unexpected extension byte (at offset 5)
        • #0      _Utf8Decoder.convertSingle (dart:convert-patch/convert_patch.dart:1789:7)
          #1      Utf8Decoder.convert (dart:convert/utf.dart:318:42)
          #2      InputStream.readString (package:archive/src/util/input_stream.dart:207:30)
          #3      new ZipDirectory.read (package:archive/src/zip/zip_directory.dart:40:30)
          #4      ZipDecoder.decodeBuffer (package:archive/src/zip_decoder.dart:19:30)
          #5      ZipDecoder.decodeBytes (package:archive/src/zip_decoder.dart:14:12)
          #6      IntelliJPlugins._findPluginXml (package:flutter_tools/src/intellij/intellij.dart:130:44)
          #7      IntelliJPlugins._readPackageVersion (package:flutter_tools/src/intellij/intellij.dart:141:40)
          #8      IntelliJPlugins.validatePackage (package:flutter_tools/src/intellij/intellij.dart:63:35)
          #9      IntelliJValidator.validate (package:flutter_tools/src/intellij/intellij_validator.dart:103:15)
          #10     asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:111:32)
          #11     asyncGuard.<anonymous closure> (package:flutter_tools/src/base/async_guard.dart:109:18)
          #12     _rootRun (dart:async/zone.dart:1428:13)
          #13     _CustomZone.run (dart:async/zone.dart:1328:19)
          #14     _runZoned (dart:async/zone.dart:1863:10)
          #15     runZonedGuarded (dart:async/zone.dart:1851:12)
          #16     runZoned (dart:async/zone.dart:1782:12)
          #17     asyncGuard (package:flutter_tools/src/base/async_guard.dart:109:3)
          #18     Doctor.startValidatorTasks (package:flutter_tools/src/doctor.dart:197:9)
          #19     Doctor.diagnose (package:flutter_tools/src/doctor.dart:301:47)
          #20     DoctorCommand.runCommand (package:flutter_tools/src/commands/doctor.dart:53:47)
          #21     FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1290:12)
          <asynchronous suspension>
          #22     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1140:27)
          <asynchronous suspension>
          #23     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
          <asynchronous suspension>
          #24     CommandRunner.runCommand (package:args/command_runner.dart:209:13)
          <asynchronous suspension>
          #25     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:288:9)
          <asynchronous suspension>
          #26     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
          <asynchronous suspension>
          #27     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:236:5)
          <asynchronous suspension>
          #28     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
          <asynchronous suspension>
          #29     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
          <asynchronous suspension>
          #30     main (package:flutter_tools/executable.dart:94:3)
          <asynchronous suspension>
    
    
    [✓] VS Code (version 1.63.2)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.32.0
    
    [✓] Connected device (3 available)
        • iPhone 13 (mobile) • 7515F01A-C1B6-456E-8559-8D2383D3719D • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-0 (simulator)
        • macOS (desktop)    • macos                                • darwin-arm64   • macOS 11.6 20G165 darwin-arm
        • Chrome (web)       • chrome                               • web-javascript • Google Chrome 97.0.4692.71
    
    ! Doctor found issues in 1 category.
    [✓] Flutter (Channel master, 2.9.0-1.0.pre.463, on macOS 11.6 20G165 darwin-arm, locale en-GB)
        • Flutter version 2.9.0-1.0.pre.463 at /Users/nexus/dev/sdks/flutters
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision e92d8ef2b1 (17 hours ago), 2022-01-23 13:20:17 -0500
        • Engine revision 4f58a01268
        • Dart version 2.17.0 (build 2.17.0-48.0.dev)
        • DevTools version 2.9.2
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
        • Android SDK at /Users/nexus/Library/Android/sdk
        • Platform android-31, build-tools 31.0.0
        • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 13.0)
        • 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 2020.3)
        • 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.10+0-b96-7249189)
    
    [✓] IntelliJ IDEA Community Edition (version 2021.3)
        • IntelliJ at /Applications/IntelliJ IDEA CE.app
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin version 213.5744.122
    
    [✓] VS Code (version 1.63.2)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.32.0
    
    [✓] Connected device (3 available)
        • iPhone 13 (mobile) • 7515F01A-C1B6-456E-8559-8D2383D3719D • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-0 (simulator)
        • macOS (desktop)    • macos                                • darwin-arm64   • macOS 11.6 20G165 darwin-arm
        • Chrome (web)       • chrome                               • web-javascript • Google Chrome 97.0.4692.71
    
    [✓] HTTP Host Availability
        • All required HTTP hosts are available
    
    • No issues found!
  4. added
    a: imagesLoading, displaying, rendering images
    frameworkflutter/packages/flutter repository. See also f: labels.
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    and removed
    in triagePresently being triaged by the triage team
    on Jan 24, 2022
  5. MartenM commented on Jan 24, 2022

    @MartenM
    Author

    This is likely related to #11655

    Is it? The rebuild of the Widget is not really a problem here. The problem is that for some reason it does not use the errorBuilder that's being provided in this rebuild.

  6. added
    P2Important issues not at the top of the work list
    on Feb 2, 2022
  7. rasitayaz commented on May 8, 2022

    @rasitayaz

    I can confirm that I am experiencing the exact same issue, pretty annoying.

  8. landonmr commented on Jun 6, 2022

    @landonmr

    any update on this issue, I'm seeing the same exact issue

  9. CodesbyRobot commented on Jun 7, 2022

    @CodesbyRobot

    +1.
    One way around is using a pushReplacement() and then a WillPopScope() that handles returning to the same page as before on the new page. The previous page loses its scrolled index (if it had any, and has to rebuild) but, with more code work, you can also make that as a passable argument and restore it, if the previous page didn't require any data, else you need to pass everything in the new page, even if not needed and then pass them back as arguments to the WillPopScope().

  10. 12 remaining items

  11. CodesbyRobot commented on Apr 5, 2024

    @CodesbyRobot

    What i ended up doing is making a function

    Future<bool> checkAssetExists(String assetPath) async {
      try {
       await rootBundle.load(assetPath);
        return true;
      } catch (e) {
        return false;
      }
    }

    praying for the garbage collector to do its work.

  12. MartenM commented on Apr 5, 2024

    @MartenM
    Author

    What i ended up doing is making a function

    Future<bool> checkAssetExists(String assetPath) async {
      try {
       await rootBundle.load(assetPath);
        return true;
      } catch (e) {
        return false;
      }
    }

    praying for the garbage collector to do its work.

    This issue is specific (at least the example) for web-loaded images.
    Does this function also work on those?

  13. CodesbyRobot commented on Apr 6, 2024

    @CodesbyRobot
    import 'package:http/http.dart' as http;
    import 'dart:ui' as ui;
    
    Future<Widget> _fetchImage(String imageUrl) async {
      final response = await http.get(Uri.parse(imageUrl));
      if (response.statusCode == 200) {
        try {
          await ui.instantiateImageCodec(response.bodyBytes);
          return Image(image: MemoryImage(response.bodyBytes));
        } catch (_) {
          return const Text("Error loading image!");
        }
      } else {
        return const Text("Error loading image!");
      }
    }
    
    
      FutureBuilder<Widget>(
                  future: _fetchImage(
                      'https://storage.googleapis.com/cms-storage-bucket/c823e53b3a1a7b0d36a9.png'),
                  builder: (context, snapshot) {
                    if (snapshot.hasData) {
                      return SizedBox(height: 100, child: snapshot.data!);
                    }
                    return const SizedBox.shrink();
                  },
                ),
    

    You can create something similar for the web using http, checking if instantiateImageCodec is disposed correctly.

  14. PerLycke commented on Mar 28, 2025

    @PerLycke

    Still an issue in 2025. A question for the image stream code maintainers: was the errorBuilder never intended to offer developers a way to handle thrown errors? If it was, why is this issue ongoing? If it wasn't, please state this in docs and close this issue with an explanation.

    Current state forces you to use "workarounds" or "hacks" to surpress errors and avoid whatever crash reporting system you use to be clogged with non wanted reports. The framework shouldn't promote the use of workarounds and hacks, but this not being fixed already certainly gives the impression it does, and that's not the Flutter we want.

    I know this is open source and it's for anyone to fix, but truth to be told, contributing to Flutter basic image features isn't easy, for several reasons, no matter how senior you are. Here's still hoping that features like showing a network image would be looked after by internal code maintainers.

  15. added 2 commits that reference this issue on Mar 28, 2025
    0db80bd
    40eb238
  16. Pluxury commented on Mar 31, 2025

    @Pluxury
  17. added 3 commits that reference this issue on Apr 1, 2025
    f1b49a3
    e17fb63
    4af29fc
  18. added a commit that references this issue on May 1, 2025
    e5e8c48
  19. added
    r: fixedIssue is closed as already fixed in a newer version
    on May 2, 2025
  20. github-actions commented on May 16, 2025

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  21. locked as resolved and limited conversation to collaborators on May 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: imagesLoading, displaying, rendering imagesfound in release: 2.8Found to occur in 2.8found in release: 2.9Found to occur in 2.9frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions