==图片资源服务捕获异常==

问题描述 投票:0回答:1

我在模拟器上运行 Flutter 项目时遇到问题。该项目运行不佳,某些图像和图标未显示。这是输出。我将不胜感激你的帮助。谢谢你。

======== Exception caught by image resource service ================================================
The following ArgumentError was thrown resolving an image codec:
Invalid argument(s): No host specified in URI
 
When the exception was thrown, this was the stack: 
#0      _HttpClient._openUrl (dart:_http/http_impl.dart:2751:9)
#1      _HttpClient.openUrl (dart:_http/http_impl.dart:2622:7)
#2      IOClient.send (package:http/src/io_client.dart:63:38)
#3      HttpFileService.get (package:flutter_cache_manager/src/web/file_service.dart:37:44)
#4      WebHelper._download (package:flutter_cache_manager/src/web/web_helper.dart:115:24)
#5      WebHelper._updateFile (package:flutter_cache_manager/src/web/web_helper.dart:97:28)
<asynchronous suspension>
#6      WebHelper._downloadOrAddToQueue (package:flutter_cache_manager/src/web/web_helper.dart:65:7)
<asynchronous suspension>
Image provider: CachedNetworkImageProvider("", scale: 1.0) 
 Image key: CachedNetworkImageProvider("", scale: 1.0): CachedNetworkImageProvider("", scale: 1.0)
====================================================================================================

我是Flutter的初学者,所以我不明白我应该做什么,也没有找到解决方案。

flutter image dart mobile android-emulator
1个回答
0
投票
CachedNetworkImageProvider("", scale: 1.0)

根据CachedNetworkImageProvider的文档,第一个参数应该是加载图像的url。但

""
不是有效的网址。

您应该将有效的 URL 传递给构造函数。

© www.soinside.com 2019 - 2024. All rights reserved.