If you can’t load network images in flutter web from other domains with API calls you will get this error:
Trying to load an image from another domain? Find answers at:
https://flutter.dev/docs/development/platform-integration/web-images
ImageCodecException: Failed to load network image.
If you use firebase storage just follow these steps:
- Open Google Cloud Console at your project
- Click on the console icon in the top right corner
- Click Open editor
- Click File->New->cors.json
- Place code below
[
{
"origin": ["*"],
"method": ["GET"],
"maxAgeSeconds": 3600
}
]
- Then Run in console:
gsutil cors set cors.json gs://bucket-name
bucket-name is the name of the storage bucket which you can find on your firebase project above the folders in the storage section