Repository navigation
Navigating to a new page causes the Image errorBuilder to be ignored. #97077
Description
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"))
);
}
}- Execute
flutter runon the code sample - Click on the button to go to the next page.
- 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
MartenM commentedon Jan 23, 2022
Seems related to the following issue #69125 and #34451.
[-]Navigator.pushNamed() causes the Image errorBuilder to be ignored.[/-][+]Navigating to a new page causes the Image errorBuilder to be ignored.[/+]danagbemava-nc commentedon Jan 24, 2022
Issue is reproducible using sample provided above.
Observations
errorBuilderworks as expected on the first pageNavigator.push(...)/Navigator.pushNamed(...))Navigator.pushReplacement(...)/Navigator.pushReplacementNamed(...))This is likely related to Pages on Navigator stack rebuild when a new page is pushed #11655code sample
logs
run_verbose.txt
flutter doctor -v
MartenM commentedon Jan 24, 2022
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.
rasitayaz commentedon May 8, 2022
I can confirm that I am experiencing the exact same issue, pretty annoying.
landonmr commentedon Jun 6, 2022
any update on this issue, I'm seeing the same exact issue
CodesbyRobot commentedon Jun 7, 2022
+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().
12 remaining items
CodesbyRobot commentedon Apr 5, 2024
What i ended up doing is making a function
praying for the garbage collector to do its work.
MartenM commentedon Apr 5, 2024
This issue is specific (at least the example) for web-loaded images.
Does this function also work on those?
CodesbyRobot commentedon Apr 6, 2024
You can create something similar for the web using http, checking if instantiateImageCodec is disposed correctly.
PerLycke commentedon Mar 28, 2025
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.
Fix: Image errorBuilder correctly handles errors during navigation tr…
Fix: Image errorBuilder correctly handles errors during navigation tr…
Pluxury commentedon Mar 31, 2025
Fix: Image errorBuilder handles errors when TickerMode is disabled
Fix: Ensure Image.errorBuilder prevents error reports on disposal
Fix: Ensure Image.errorBuilder prevents error reports on disposal
Fix: Ensure Image.errorBuilder reliably prevents error reporting (wit…
github-actions commentedon May 16, 2025
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 -vand a minimal reproduction of the issue.