部署到Web服务器时未显示Flutter Web资产图像 [英] Flutter web asset images not displaying when deployed to web server
本文介绍了部署到Web服务器时未显示Flutter 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屋!
查看全文