部署到Web服务器时未显示Flutter Web资产图像 [英] Flutter web asset images not displaying when deployed to web server

查看:61
本文介绍了部署到Web服务器时未显示Flutter Web资产图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个使用网络映像和资产映像的项目,在PC上进行调试时一切正常,但是当我将其部署到Web服务器时,网络映像可以正常工作,但是资产图片完全不显示.当我在网络浏览器控制台中检查页面时,出现以下错误:

I have created a flutter web project which uses network images and asset images, everything works fine when debugging on my pc but when I deploy it to a web server, the network images work fine but the asset images dont show at all. When I Inspect the page in the web browsers consol, I get the error below:

$1 @ window.dart:120
/assets/slack.png:1 Failed to load resource: the server responded with a status of 503 ()
window.dart:120 Error while trying to load an asset: Failed to load asset at "assets/slack.png" (503)

$1 @ window.dart:120
/assets/flutterLogo.png:1 Failed to load resource: the server responded with a status of 503 ()
window.dart:120 Error while trying to load an asset: Failed to load asset at "assets/flutterLogo.png" (503)

$1 @ window.dart:120
/assets/kross.jpg:1 Failed to load resource: the server responded with a status of 503 ()
window.dart:120 Error while trying to load an asset: Failed to load asset at "assets/kross.jpg" (503)

$1 @ window.dart:120
/assets/codingRocket2.png:1 Failed to load resource: the server responded 

推荐答案

您应将照片添加到pubspec.yaml文件中,并将素材资源文件夹上传到Web服务器.可能是关于不上传文件夹

You should add photos to pubspec.yaml file and upload your assets folder to web server. Probably it is about not uploading folder

这篇关于部署到Web服务器时未显示Flutter Web资产图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆