gpt4 book ai didi

firebase - Flutter web - 无法加载网络图像

转载 作者:行者123 更新时间:2023-12-04 14:08:25 27 4
gpt4 key购买 nike

我的项目的 firebase 存储桶中有我想​​在 UI 中显示的图像。
我按照另一个堆栈溢出答案中的说明进行操作,但它对我不起作用。

For being able to display your images from Firebase Storage on aFlutter web page you have to configure your data for CORS.

Open the GCP console, select your project and start a cloud terminalsession by clicking the >_ icon button in the top navbar. Click theopen editor button (pencil icon), then create the cors.json file. Rungsutil cors set cors.json gs://your-bucket The cors.json file shouldlook like this:

[ {"origin": ["*"],"method": ["GET"],"maxAgeSeconds": 3600 } ] I set the origin to * which means that every website can display your images. But you can also insert thedomain of your website there to restrict the access.

If you need more information:https://cloud.google.com/storage/docs/configuring-cors


我在云平台上看到我的项目和存储桶的更新,但我收到相同的错误消息:
Failed to load network image.
Image URL: gs://---------------------------------.png
Trying to load an image from another domain? Find answers at:
https://flutter.dev/docs/development/platform-integration/web-image
我还遵循了这个人关于如何访问存储图像的教程。他使用了 Image.network 小部件,这也是我正在做的。它对我不起作用。下面的截图是我看到的。黑框是来自存储位置的 URL。
enter image description here

最佳答案

使用 HTML 渲染器
在你的终端中运行这个

flutter run -d chrome --web-renderer html

关于firebase - Flutter web - 无法加载网络图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66537991/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com