在Flutter中获取请求:-无法将“字符串"分配给参数类型"Uri" [英] Get Request in Flutter:- 'String' can't be assigned to the parameter type 'Uri'

查看:113
本文介绍了在Flutter中获取请求:-无法将“字符串"分配给参数类型"Uri"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将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"))

这篇关于在Flutter中获取请求:-无法将“字符串"分配给参数类型"Uri"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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