Baseflow / Baseflow/flutter_cached_network_image

CachedNetworkImage logs errors / crashes on Windows when image URL returns 404

Open
#1,023 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
Dart
Stars
2.6k
Forks
731
Avg merge
3d 9h
Merged PRs (30d)
1

Description

Using CachedNetworkImage on Windows, if the image URL is invalid (returns 404 from the server), the app repeatedly logs:

[ERROR:flutter/shell/platform/windows/task_runner_window.cc(61)] Failed to post message to main thread

and sometimes the app crashes.

This happens even when using errorWidget or a custom CacheManager.

Steps to Reproduce:

Use CachedNetworkImage with an invalid URL, for example:

CachedNetworkImage(
imageUrl: "https://brickfever.nl/wp-content/uploads/2022/11/LOGO-2022-Owen-EXPORT.png",
errorWidget: (context, url, error) => Icon(Icons.error),
)

Run the app on Windows.

Observe repeated error logs and/or crash.

Expected behavior:

Image should fallback to errorWidget.

No repeated log spam or crash.

Cache should not store invalid 404 images.

Environment:

Flutter version: 3.35.3

flutter_cache_manager ^3.4.0

cached_network_image version: cached_network_image: ^3.4.1

Platform: Windows 10/11

Additional context:

Issue only occurs on Windows; Android/iOS works fine.

The URL being invalid (404) triggers the log/crash immediately.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.