Ad

CORS Not Image-enabled. What To Do?

- 1 answer

In the two examples below, the first returns the image correctly, in the second it gives an error:

"Failed to load network image".

Is this a CORS issue? That is, on the server in the second example, cross-origin is not enabled? What to do?

Image.network('https://cdn.pixabay.com/photo/2017/12/06/11/03/brazil-3001462_960_720.png')
Image.network('https://www.camara.leg.br/internet/deputado/bandep/204379.jpg')

Thank you very much

Ad

Answer

It's a duplicate question of Flutter web can't load network image from another domain

Use html renderer to overcome the issue, cis here for chrome.

flutter run -d c --web-renderer html
Ad
source: stackoverflow.com
Ad