Using CachedNetworkImageProvider in an OctoImage with headers seems not work on flutter web while it is working on flutter mobile.
OctoImage(
image: CachedNetworkImageProvider(
Endpoints.SERVER_ADDRESS + "profils/$userId/picture/$userImageSlug",
headers: {"Authorization": _token},
),
placeholderBuilder: OctoPlaceholder.circularProgressIndicator(),
errorBuilder: (context, url, error) => _buildInitialUserWidget(),
fit: BoxFit.cover,
)
I try to use version "2.2.0+1" and "2.3.0-beta" of CachedNetworkImage without success.
Header "Authorization" is not in headers of the HTTP call.
Maybe there is this something wrong with my code ?
No its correct that it's not working. I took the code from NetworkImage and later found out that that one also doesn't support headers. I have to figure out how to decode the image on the web differently.
Should be fixed in 2.3.0-beta.1. In this version I don't do anything differently from mobile as I made the cachemanager always download the file on web.
@renefloor thanks a lot ! That fixes the issue for me.
Any idea on why I am hitting a CORS issue with this and not flutter's Image.Network? Tried passing headers on 2.3.0-beta.1, but it did not fix.
{'Access-Control-Allow-Origin': '*'}
@MichealReed yes, because following this discussion the image is not processed as a normal image on the web, but as a http call and then the result is shown in the image. However, I'm aware that this gives some drawbacks next to the benefits it provides, so I partly reverted this change by giving a choice.
I thought I already released it last week, but apparently it is still an open PR: #408. In this PR the default is still HttpGet, but I guess I'll change it to ImageElement as that is the more suitable choice for most people. HttpGet should only be used in very specific circumstances.
I still have the same problem on cached_network_image: ^2.5.1 and can not downgrade the version to 2.3.0-beta.1
any solution?
Same issue on cached_network_image: ^3.0.0. :(
Worked as intended on cached_network_image: ^2.2.0+1 before migrating to Flutter 2.
Hello,
I have the same issue on cached_network_image: ^3.0.0. Does not work on web but works with iPhone.
It would be nice if you can fix this bug.
Thank you for your work !
Most helpful comment
Should be fixed in 2.3.0-beta.1. In this version I don't do anything differently from mobile as I made the cachemanager always download the file on web.