Trying to load an image from another domain?

19 de enero de 2022
Posted in Tutorials
19 de enero de 2022 ricardo

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:

  1. Open Google Cloud Console at your project
  2. Click on the console icon in the top right corner
  3. Click Open editor
  4. Click File->New->cors.json
  5. Place code below
[
  {
    "origin": ["*"],
    "method": ["GET"],
    "maxAgeSeconds": 3600
  }
]
  1. 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

, ,
Contact

Get Connected.

We welcome you to contact us for more information
about any of our products or services.

Let’s Talk About Your Project

Build a stronger connection with your users through memorable mobile experiences.

Let’s Talk About Your Idea

Give users the outstanding mobile experience they deserve.

Let’s Talk About Your Content

Stunning apps to grow and enrich your business.

made with ❤️

Contact