简体   繁体   English

(FLUTTER)尝试显示网络图像时出错

[英](FLUTTER) Getting error while trying to display a network image whose URL I am getting as an argument from the previous screen

My first screen is using the same image and I am not facing any issue there but when I go to the second screen and wanna use the same image, I am getting "Invalid argument(s): No host specified in URI file:///Instance%20of%20'Future%3Cdynamic%3E'".我的第一个屏幕使用相同的图像,我在那里没有遇到任何问题,但是当我 go 到第二个屏幕并想使用相同的图像时,我得到“无效参数:URI 文件中指定的主机:// /Instance%20of%20'Future%3Cdynamic%3E'"。 I tried Urifullencode and made sure that the URL of the image has https:// in it but it is still not working for some reason我尝试了 Urifullencode 并确保图像的 URL 中有 https:// 但由于某种原因它仍然无法正常工作

here is the code:这是代码:

getImageUrl() async {
    var image = await Get.arguments['imageUrl'];
    if (image == null){
      return 'https://miro.medium.com/max/880/0*H3jZONKqRuAAeHnG.jpg';
    }
    else{
      return image;
    }
  }

following is the widget in which I am using the above function以下是我使用上述 function 的小部件

 ClipRRect(
                borderRadius: BorderRadius.circular(10),
                child: Image.network(
                Uri.encodeFull(getImageUrl().toString()),
                  ),
              ),

And lastly the error:最后是错误:

════════ Exception caught by image resource service ════════════════════════════ ════════ 图片资源服务捕获的异常════════════════════════════

The following ArgumentError was thrown resolving an image codec: Invalid argument(s): No host specified in URI file:///Instance%20of%20'Future%3Cdynamic%3E'解析图像编解码器时引发以下 ArgumentError:无效参数:URI 文件中未指定主机:///Instance%20of%20'Future%3Cdynamic%3E'

I still get the same error even if I remove async-await, and in my emulator as soon as I navigate to the second screen, everything works well except the container that is holding the network image (it displays a crossed-out image of the same error message).即使我删除了 async-await,我仍然会遇到同样的错误,并且在我的模拟器中,一旦我导航到第二个屏幕,除了保存网络图像的容器(它显示一个划掉的图像相同的错误信息)。

ah sorry, silly mistake on my part.啊对不起,我犯了一个愚蠢的错误。 The screen from where I was getting the arguments had a spelling mistake in one of the argument variables.我从中获取 arguments 的屏幕在其中一个参数变量中有拼写错误。 Fixed it, its working now.修复它,它现在工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 flutter 中尝试制作启动画面时出现错误 255,我该如何解决? - While trying to make splash screen with in flutter I am getting an error 255 how do I fix it? 使用 package CarouselSlider 时出现错误,它显示错误类型“图像”不是 flutter 中“字符串”类型的子类型 - I am getting error while using package CarouselSlider it display error type 'Image' is not a subtype of type 'String' in flutter 我在尝试将数据从云 Firestore 带到我的 flutter 应用程序时遇到此错误 - I am getting this error while am trying to bring data from cloud firestore to my flutter app 我在尝试运行我的颤振项目时遇到错误 - I am getting error while trying to run my flutter project Flutter Dropdown selectedValue(来自上一个屏幕的参数)未更新 - Flutter Dropdown selectedValue(argument from previous screen) not getting updated 谁能告诉我为什么我在尝试实现动画时会在 Flutter 中收到此错误 - Can anybody tell why am I getting this error in Flutter while trying to implement animation 我在颤振中收到一个调用空错误的吸气剂。 在尝试访问列表的长度时 - I am getting a getter called on null error in flutter. while trying to access the length of a list const 列表文字中的值必须是常量,在 Flutter 中将图像添加到列小部件时出现此错误 - The values in a const list literal must be constants, I am getting this error while adding an Image to Column Widget in Flutter Flutter 我一直变坏 State:没有元素。 当我试图从上一个屏幕获取我的用户 ID 时 - Flutter i keep getting Bad State: No element. when im trying to get my userId from previous screen 在运行颤振应用程序时出现此错误 - while running the flutter app i am getting this error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM