在Flutter中获取请求:-无法将“字符串"分配给参数类型"Uri"

在Flutter中获取请求:-无法将“字符串

问题描述:

我已将pubspec.yaml文件中的http版本添加到^ 0.13.0中,我只需要从Pu​​blic-apis.io获取Yes Yes API请求,就可以在使用Get请求的同时生成一些Yes/No GIF.它说,

I have added the http version to ^0.13.0 in pubspec.yaml file and I just need to get the Yes NO API request from the Public-apis.io to generate some Yes/No GIFs, while using the Get request it says,

不能将参数类型'String'分配给参数类型'Uri'.

The argument type 'String' can't be assigned to the parameter type 'Uri'.

对此有任何解决方案吗?在此处输入图像描述

Any solution for this?enter image description here

您应使用:

http.get(Uri.parse("https://yesno.wtf/api"))