Open sandeep9607 opened 4 years ago
For others coming here, you may be mistaking the IDE debugger stopping on the exception as the CachedNetworkImage
not working by showing the errorWidget
. That's what I thought. However, you can press the continue button or turn off the "Uncaught exceptions" breakpoint and the errorWidget
will still show. See issue #467 and my Stack Overflow Q&A:
@suragch thanks for your answer, I included in a newly made FAQ: https://github.com/Baseflow/flutter_cached_network_image/commit/d4b09daf3442902afa49976c19ba9adf51f292e8
Hi ! I have a carousel that had this error, and when one of the image was failing, all the others failed. So I solved it enforcing each CachedNetworkImage() with UniqueKey(), so flutter has each widget uniquely identified. I hope it helps!
I used to have the same issue! If you have a break on exceptions enabled the debugger stops, but that's because the dart VM doesn't always know whether an exception is caught or not. If you continue this still shouldn't freeze your app.
crashalitics also catch this issue. @renefloor there is something really weired
No host specified means the url didn't start with http(s)://
. Do you have any idea what the url could have been?
cached_network_image: ^2.0.0
I/flutter (23961): CacheManager: Failed to download file from http://host/images/a.png with error: I/flutter (23961): SocketException: Failed host lookup: 'host' (OS Error: No address associated with hostname, errno = 7)
In your original post you did have 'http', but you had an invalid hostname 'host'.
It's for example.but it happends for all Images @renefloor
2021-05-09 14:09:46.585635+0530 Runner[5713:2950075] flutter: CacheManager: Failed to download file from with error:
Invalid argument(s): No host specified in URI
2021-05-09 14:09:46.600427+0530 Runner[5713:2950075] flutter: ══╡ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE ╞════════════════════════════════════════════════════
2021-05-09 14:09:46.600546+0530 Runner[5713:2950075] flutter: The following ArgumentError was thrown resolving an image codec:
2021-05-09 14:09:46.600590+0530 Runner[5713:2950075] flutter: Invalid argument(s): No host specified in URI
2021-05-09 14:09:46.600622+0530 Runner[5713:2950075] flutter:
2021-05-09 14:09:46.600660+0530 Runner[5713:2950075] flutter: When the exception was thrown, this was the stack:
2021-05-09 14:09:46.600700+0530 Runner[5713:2950075] flutter: #0 _HttpClient._openUrl (dart:_http/http_impl.dart:2407:9)
2021-05-09 14:09:46.600732+0530 Runner[5713:2950075] flutter: #1 _HttpClient.openUrl (dart:_http/http_impl.dart:2323:7)
2021-05-09 14:09:46.600761+0530 Runner[5713:2950075] flutter: #2 IOClient.send (package:http/src/io_client.dart:31:37)
2021-05-09 14:09:46.600975+0530 Runner[5713:2950075] flutter: #3 HttpFileService.get (package:flutter_cache_manager/src/web/file_service.dart:33:44)
2021-05-09 14:09:46.601076+0530 Runner[5713:2950075] flutter: #4 WebHelper._download (package:flutter_cache_manager/src/web/web_helper.dart:106:24)
2021-05-09 14:09:46.601673+0530 Runner[5713:2950075] flutter: #5 WebHelper._updateFile (package:flutter_cache_manager/src/web/web_helper.dart:91:28)
2021-05-09 14:09:46.601903+0530 Runner[5713:2950075] flutter:
Valid url @renefloor https://hd.tudocdn.net/874944?w=646&h=284
I/flutter (17973): I/flutter (17973): Image provider: CachedNetworkImageProvider("", scale: 1.0) I/flutter (17973): Image key: CachedNetworkImageProvider("", scale: 1.0): I/flutter (17973): CachedNetworkImageProvider("", scale: 1.0) I/flutter (17973): ════════════════════════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by image resource service ════════════════════════════ The following ArgumentError was thrown resolving an image codec: Invalid argument(s): No host specified in URI
When the exception was thrown, this was the stack
package:http/src/io_client.dart:31
package:flutter_cache_manager/…/web/file_service.dart:33
package:flutter_cache_manager/…/web/web_helper.dart:106 ... Image provider: CachedNetworkImageProvider("", scale: 1.0) Image key: CachedNetworkImageProvider("", scale: 1.0): CachedNetworkImageProvider("", scale: 1.0) ════════════════════════════════════════════════════════════════════════════════ URl not loading is: https://firebasestorage.googleapis.com/v0/b/mesocialmobile.appspot.com/o/user%2FN2q4tIWzRqa460xsHcbusPMtq4x2%2FprofileImage%2F952651d0-a026-11eb-bee4-438e4c3ebe8a.jpg?alt=media&token=681da556-540c-40ae-98a1-6a968ab24fdf
2021-05-10 11:09:52.935491+0530 Runner[6333:3213281] flutter: Image provider: CachedNetworkImageProvider("", scale: 1.0) 2021-05-10 11:09:52.935514+0530 Runner[6333:3213281] flutter: Image key: CachedNetworkImageProvider("", scale: 1.0): 2021-05-10 11:09:52.935535+0530 Runner[6333:3213281] flutter: CachedNetworkImageProvider("", scale: 1.0) 2021-05-10 11:09:52.935559+0530 Runner[6333:3213281] flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════ 2021-05-10 11:09:53.657355+0530 Runner[6333:3213281] flutter: CacheManager: Failed to download file from with error: Invalid argument(s): No host specified in URI
@renefloor it work first time perfectly, but second time it suck, it crash iOS version, while android is able to survive.
In my case, I am passing the null value to imgurl that's why the problem occurs. If you have a problem, just print the URL if it is null or not & then provide a proxy image URL to check it's working to not.
Hi. I don't want to turn off uncaught exceptions in my IDE. It helps me catch runtime errors. This widget constantly breaking on uncaught exceptions is problematic for development.
How can we show a placeholder image, if application is failed or not able to fetch image content from server? Kindly suggest. Thanks.
How can we show a placeholder image, if application is failed or not able to fetch image content from server? Kindly suggest. Thanks.
By setting the placeholder as errorWidget:
CachedNetworkImage(
imageUrl: "http://via.placeholder.com/200x150",
imageBuilder: (context, imageProvider) => Container(
decoration: BoxDecoration(
image: DecorationImage(
image: imageProvider,
fit: BoxFit.cover,
colorFilter:
ColorFilter.mode(Colors.red, BlendMode.colorBurn)),
),
),
placeholder: (context, url) => CircularProgressIndicator(),
errorWidget: (context, url, error) => CircularProgressIndicator(),
),
You can also only set the placeholder and not the errorWidget, in that case the placeholder will be used as errorWidget.
Same issue
Same issue here
Same issue :(
Hey @renefloor ! First of all thanks to you and your team for such a fantastic plugin!
but I was thinking... if this issue is so prevalent that the team has had to add a "notice" on the plugin page and since y'all also manage the plugin that is throwing the "error" that isn't wrapped in a try catch
Why not just wrap
throw HttpExceptionWithStatus(
response.statusCode,
'Invalid statusCode: ${response.statusCode}',
uri: Uri.parse(cacheObject.url),
);
within the "web_helper.dart" file in the "flutter_cache_manager" plugin with a try catch?
That would eliminate the need for you too clarify, constantly be bothered by notifications here, and as a bonus, we could develop without worrying about something that isn't actually breaking anything without having to turn off tools that we use every day
same issues here, is there any way to solve it ?
@b-cancel because the ImageProvider has to return an image or an exception. If we catch the exception, what will we return? A never ending loading indicator?
@b-cancel because the ImageProvider has to return an image or an exception. If we catch the exception, what will we return? A never ending loading indicator?
That is what you are currently telling us to do with this https://github.com/Baseflow/flutter_cached_network_image/issues/336#issuecomment-862182001 😕 You are literally making it load indefinitely on an error. 😢
In my case. I have an jwt protected route that needs a valid auth header. Your plugin does not give control on when to flush CacheManager? Because my luck means that once I am renewing the user's token, your plugin wants to re-download the image resulting in a 401:
flutter: CacheManager: Failed to download file from https://redacted/download?fileName=WnlCcuwy2_6ImgIZ73234lLsXs6M.png with error:
HttpException: Invalid statusCode: 401, uri = https://redacted/download?fileName=WnlCcuwy2_6ImgIZ73234lLsXs6M.png
Which means I need to change my list from a Stream to a Future or else this error will constantly pop up 😿
Can we not just do a silent retry? And after a certain amount of attempts can then throw the error, just in case that the internet had a bit of an issue or the server was a bit busy....
@nehal076
FIX IT !
That's not an appropriate comment for an open source repository. Let's be respectful of the maintainers' time and work that they provide freely to us. If something isn't working, we can help by researching the root cause ourselves and proposing a solution.
@nehal076
FIX IT !
That's not an appropriate comment for an open source repository. Let's be respectful of the maintainers' time and work that they provide freely to us. If something isn't working, we can help by researching the root cause ourselves and proposing a solution.
Okay, I apologize for my comment.
@TylerByte666
That is what you are currently telling us to do with this #336 (comment) 😕 You are literally making it load indefinitely on an error. 😢
Not completely sure what you mean here, but it doesn't load indefinitely, it just shows a placeholder instead of the image. When it has an error it stops loading.
In my case. I have an jwt protected route that needs a valid auth header. Your plugin does not give control on when to flush CacheManager? Because my luck means that once I am renewing the user's token, your plugin wants to re-download the image resulting in a 401:
flutter: CacheManager: Failed to download file from https://redacted/download?fileName=WnlCcuwy2_6ImgIZ73234lLsXs6M.png with error: HttpException: Invalid statusCode: 401, uri = https://redacted/download?fileName=WnlCcuwy2_6ImgIZ73234lLsXs6M.png
Which means I need to change my list from a Stream to a Future or else this error will constantly pop up 😿
Can we not just do a silent retry? And after a certain amount of attempts can then throw the error, just in case that the internet had a bit of an issue or the server was a bit busy....
Here I also not fully sure what the problem is. Is it that you don't really get the exception in the app because it can still load the cached version? What exactly did you change from a Stream to a Future? You can always provide headers so it can download the file if needed.
No what I mean is sometimes the image failes to load completely. I then get the exception output as above and vscode will do its normal breaks.
It hasn't happened in a while so I can only imagine it may be internet related. It was a list of users one of which did not have a cached image so when my user list(this is the stream) loaded in the list for the first time I got that error.
Thus my suggestion for a silent retry, which I was able to do in my app by wrapping the code in a try catch and then retracing on that error once or twice after a 30 sec timeout.
I already use the headers, with my bearer token but for some reason I got this error when my token was refreshing as well... I have to make a request to our backend to refresh the token(after an hour or so) and replace the one sent to your plugin. So that kinda blew a hole in my its the internet problem causing it. I will try see if it returns and try provide more info.
On Tue, 02 Nov 2021, 10:39 Rene Floor, @.***> wrote:
@TylerByte666 https://github.com/TylerByte666
That is what you are currently telling us to do with this #336 (comment) https://github.com/Baseflow/flutter_cached_network_image/issues/336#issuecomment-862182001 😕 You are literally making it load indefinitely on an error. 😢
Not completely sure what you mean here, but it doesn't load indefinitely, it just shows a placeholder instead of the image. When it has an error it stops loading.
In my case. I have an jwt protected route that needs a valid auth header. Your plugin does not give control on when to flush CacheManager? Because my luck means that once I am renewing the user's token, your plugin wants to re-download the image resulting in a 401:
flutter: CacheManager: Failed to download file from https://redacted/download?fileName=WnlCcuwy2_6ImgIZ73234lLsXs6M.png with error:
HttpException: Invalid statusCode: 401, uri = https://redacted/download?fileName=WnlCcuwy2_6ImgIZ73234lLsXs6M.png
Which means I need to change my list from a Stream to a Future or else this error will constantly pop up 😿
Can we not just do a silent retry? And after a certain amount of attempts can then throw the error, just in case that the internet had a bit of an issue or the server was a bit busy....
Here I also not fully sure what the problem is. Is it that you don't really get the exception in the app because it can still load the cached version? What exactly did you change from a Stream to a Future? You can always provide headers so it can download the file if needed.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Baseflow/flutter_cached_network_image/issues/336#issuecomment-957223665, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIV7HB45EZ7ODC5ZAKIYKYLUJ6PVPANCNFSM4KT2WEOA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
@TylerByte666 I also have plans to add a retry mechanism. Would that be enough? Can the retry keep using the same headers, or should it request new headers?
That should be perfect, bro! 100%. Headers should be changeable if that's possible, I'm sure others need to send new tokens with the request too just incase the needed to refresh 😉
I love you guys and thank you so much for all the hardwork 💜
On Thu, 04 Nov 2021, 20:56 Rene Floor, @.***> wrote:
@TylerByte666 https://github.com/TylerByte666 I also have plans to add a retry mechanism. Would that be enough? Can the retry keep using the same headers, or should it request new headers?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Baseflow/flutter_cached_network_image/issues/336#issuecomment-961328962, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIV7HB2FXA5QKF67CN62O4TUKLJMZANCNFSM4KT2WEOA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
We have been getting images from a repository and sometimes some images doesn't exist. We show a default image in those cases. We don't want our console logs to be cluttered with so much noise about the same error over and over again.
There are so many folks complaining about it so I am not sure why nobody from maintainers is looking to understand it. We can handle exceptions, errors and print whatever we want but this is a very valid scenario and let us handle it based on our use case.
I noticed earlier issues were also closed without resolution https://github.com/Baseflow/flutter_cached_network_image/issues/273
We have been getting images from a repository and sometimes some images doesn't exist. We show a default image in those cases. We don't want our console logs to be cluttered with so much noise about the same error over and over again.
There are so many folks complaining about it so I am not sure why nobody from maintainers is looking to understand it. We can handle exceptions, errors and print whatever we want but this is a very valid scenario and let us handle it based on our use case.
I noticed earlier issues were also closed without resolution #273
Exactly same issue here. The problem isn't being network issue or image temporary not available. Sometimes the image URL simply expired or entered wrongly for some reason.
In that scenario, I'd expect the plugin to render errorWidget and silent the error.
Imagine you have a list of 10+ invalid image links, every time you hot-reload this list you need to click 10+ times continue on the debugger to do debugging...
IMHO the plugin should gracefully handle invalid image URL error if errorWidget is provided, otherwise throw error as it is.
Thanks for the great plugin though :)
Same issue here. the app seems to be crashing in production due to cached_network_image. Im playing around with https://pub.dev/packages/optimized_cached_image/ lets see how that goes
The issue still remains, and the odd thing is that happens only on certain devices.
I think most problems seem to be with non-english file naming. I've never had a problem with image files named only in English.
Is there any solution about this?
the app is probably crashing in production for me as well for the same reason - I am getting this report in Crashlytics (FATAL) for multiple users now
is there a way to walk around it i.e - like adding some sort of try & catch (I tried Try/catch but obviously it didn't work for me)
the app is probably crashing in production for me as well for the same reason - I am getting this report in Crashlytics (FATAL) for multiple users now
is there a way to walk around it i.e - like adding some sort of try & catch (I tried Try/catch but obviously it didn't work for me)
Yes this is getting annoying... Even try catch wouldn't suspend the error.
Is there anyone able to help look into this please?
I also experienced this issue, and could not find a flutter way to solve the 404 issue which crashes the app.
As a solution, I am using imagekit as a CDN and we can tell imagekit to display a default image if the original image is missing: https://docs.imagekit.io/features/default-images
Thanks for this great plugin.
But why the console is cluttered with all that exceptions even if I provided an error builder? I have a list of users with like 20+ image and this is very annoying.
I managed to reproduce the error locally - and I have a more descriptive logs from crashlytics:
Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: HttpException: Invalid statusCode: 403, uri = https://hiding-the-real-url loading image. Error thrown Non-Fatal error occured [Unhandled Error]. at CachedNetworkImage._octoErrorBuilder(cached_image_widget.dart:319) at ImageHandler._errorBuilder(image_handler.dart:299) at _ImageState.build(image.dart:1266) at StatefulElement.build(framework.dart:4870) at ComponentElement.performRebuild(framework.dart:4754) at StatefulElement.performRebuild(framework.dart:4928) at Element.rebuild(framework.dart:4477) at BuildOwner.buildScope(framework.dart:2659) at WidgetsBinding.drawFrame(binding.dart:882) at RendererBinding._handlePersistentFrameCallback(binding.dart:363) at SchedulerBinding._invokeFrameCallback(binding.dart:1144) at SchedulerBinding.handleDrawFrame(binding.dart:1081) at SchedulerBinding._handleDrawFrame(binding.dart:995)
can anyone from the contributors look at this?
I managed to reproduce the error locally - and I have a more descriptive logs from crashlytics:
Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: HttpException: Invalid statusCode: 403, uri = https://hiding-the-real-url loading image. Error thrown Non-Fatal error occured [Unhandled Error]. at CachedNetworkImage._octoErrorBuilder(cached_image_widget.dart:319) at ImageHandler._errorBuilder(image_handler.dart:299) at _ImageState.build(image.dart:1266) at StatefulElement.build(framework.dart:4870) at ComponentElement.performRebuild(framework.dart:4754) at StatefulElement.performRebuild(framework.dart:4928) at Element.rebuild(framework.dart:4477) at BuildOwner.buildScope(framework.dart:2659) at WidgetsBinding.drawFrame(binding.dart:882) at RendererBinding._handlePersistentFrameCallback(binding.dart:363) at SchedulerBinding._invokeFrameCallback(binding.dart:1144) at SchedulerBinding.handleDrawFrame(binding.dart:1081) at SchedulerBinding._handleDrawFrame(binding.dart:995)
can anyone from the contributors look at this?
It happens to me yesterday too plss fix itt
will someone take a look at this?
在flutter_cache_manager 3.3.0 中添加注释文件web_help.dart
// if (!hasNewFile && !keepOldFile) {
// throw HttpExceptionWithStatus( // response.statusCode, // 'Invalid statusCode: ${response.statusCode}', // uri: Uri.parse(cacheObject.url), / /); // }
并在 cached_network_image 3.2.1 中更改文件 _image_loader.dart
catch (exception, stack) {
// 根据抛出异常的位置,图像缓存可能根本没有 机会跟踪缓存中的键。 // 调度一个微任务,让缓存有机会添加密钥。 scheduleMicrotask(() { evictImage(); }); chunkEvents.addError(异常,堆栈); //重新抛出; }
Thank you very much, it solved my problem, thumbs u
This is a really good package, I would hate to switch to a different one. Can someone from the contributors please have a look?
This is a constant complaint for long time and I am not sure if this message is reaching authors.
Can anyone want to consider forking or submit a pull request with fix ? Should be simple since it is just some error messages printing.
On May 18, 2022, at 2:02 PM, Hasan M. Hallak @.***> wrote:
Thanks for this great plugin.
But why the console are cluttered with all that exceptions even if I provided an error builder? I have a list of user with like 20+ image and this is very annoying.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.
For crashlytics as a workaround you can filter for this Error before actually sending it to crashlytics like this:
FlutterError.onError = (flutterErrorDetails) async {
if (flutterErrorDetails.library == "image resource service" &&
flutterErrorDetails.exception
.toString()
.startsWith("HttpException: Invalid statusCode: 404, uri")) {
return;
}
await FirebaseCrashlytics.instance
.recordFlutterFatalError(flutterErrorDetails);
return;
};
PS C:\Users\User\Desktop\OKD\okd> flutter run
Launching lib\main.dart on CPH2387 in debug mode...
../../../AppData/Local/Pub/Cache/hosted/pub.dev/cached_network_image-3.2.3/lib/src/image_provider/_image_loader.dart:1:1: Error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
Try adding the name of the type of the variable or the keyword 'var'.
cimport 'dart:async';
^^^^^^^
../../../AppData/Local/Pub/Cache/hosted/pub.dev/cached_network_image-3.2.3/lib/src/image_provider/_image_loader.dart:1:1: Error: Expected ';' after this.
cimport 'dart:async';
^^^^^^^
../../../AppData/Local/Pub/Cache/hosted/pub.dev/cached_network_image-3.2.3/lib/src/image_provider/_image_loader.dart:1:9: Error: Expected a declaration, but got ''dart:async''.
cimport 'dart:async';
^^^^^^^^^^^^
../../../AppData/Local/Pub/Cache/hosted/pub.dev/cached_network_image-3.2.3/lib/src/image_provider/_image_loader.dart:1:21: Error: Unexpected token ';'.
cimport 'dart:async';
^
../../../AppData/Local/Pub/Cache/hosted/pub.dev/cached_network_image-3.2.3/lib/src/image_provider/_image_loader.dart:2:1: Error: Directives must appear before any declarations.
Try moving the directive before any declarations.
import 'dart:typed_data';
^^^^^^
../../../AppData/Local/Pub/Cache/hosted/pub.dev/cached_network_image-3.2.3/lib/src/image_provider/_image_loader.dart:3:1: Error: Directives must appear before any declarations.
Try moving the directive before any declarations.
import 'dart:ui' as ui;
^^^^^^
../../../AppData/Local/Pub/Cache/hosted/pub.dev/cached_network_image-3.2.3/lib/src/image_provider/_image_loader.dart:4:1: Error: Directives must appear before any declarations.
Try moving the directive before any declarations.
import 'dart:ui';
^^^^^^
../../../AppData/Local/Pub/Cache/hosted/pub.dev/cached_network_image-3.2.3/lib/src/image_provider/_image_loader.dart:6:1: Error: Directives must appear before any declarations.
Try moving the directive before any declarations.
import 'package:cached_network_image_platform_interface/cached_network_image_platform_interface.dart';
^^^^^^
../../../AppData/Local/Pub/Cache/hosted/pub.dev/cached_network_image-3.2.3/lib/src/image_provider/_image_loader.dart:7:1: Error: Directives must appear before any declarations.
Try moving the directive before any declarations.
import 'package:flutter/material.dart';
^^^^^^
../../../AppData/Local/Pub/Cache/hosted/pub.dev/cached_network_image-3.2.3/lib/src/image_provider/_image_loader.dart:8:1: Error: Directives must appear before any declarations.
Try moving the directive before any declarations.
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
^^^^^^
../../../AppData/Local/Pub/Cache/hosted/pub.dev/cached_network_image-3.2.3/lib/src/image_provider/_image_loader.dart:10:1: Error: Directives must appear before any declarations.
Try moving the directive before any declarations.
import 'package:cached_network_image_platform_interface'
^^^^^^
../../../AppData/Local/Pub/Cache/hosted/pub.dev/cached_network_image-3.2.3/lib/src/image_provider/_image_loader.dart:13:1: Error: Directives must appear before any declarations.
Try moving the directive before any declarations.
import 'package:cached_network_image_platform_interface'
^^^^^^
../../../AppData/Local/Pub/Cache/hosted/pub.dev/cached_network_image-3.2.3/lib/src/image_provider/_image_loader.dart:24:5: Error: Type 'StreamController' not found.
StreamController
FAILURE: Build failed with an exception.
Where: Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1201
What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command 'C:\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 17s how to solve this error
For crashlytics as a workaround you can filter for this Error before actually sending it to crashlytics like this:
FlutterError.onError = (flutterErrorDetails) async { if (flutterErrorDetails.library == "image resource service" && flutterErrorDetails.exception .toString() .startsWith("HttpException: Invalid statusCode: 404, uri")) { return; } await FirebaseCrashlytics.instance .recordFlutterFatalError(flutterErrorDetails); return; };
I believe this works for solving firebase crashes, but there is another problem:
If you have a given URL, say example.com/image-123.png
and server returns 404
, then the cache library will try to load that image over and over again, even if same response is always HTTP 404.
According to HTTP specifications, 4XX errors means some sort of client error, and therefore the problem is the request, not the server. You shouldn't retry the same request for 4XX errors because I'd expect the same response each time. Therefore, the cache library should store the result (HTTP 404) and return that instead.
has anyone in the community found an alternative library that properly caches HTTP 4XX results?
It's so sad that the maintainers doesn't consider this as an issue
It's been 4 years, but they still don't acknowledge this as an issue!!!
cached_network_image: ^2.0.0
I/flutter (23961): CacheManager: Failed to download file from http://host/images/a.png with error: I/flutter (23961): SocketException: Failed host lookup: 'host' (OS Error: No address associated with hostname, errno = 7)