在 Flutter 中获取请求:- 'String' 不能分配给参数类型 'Uri' [英] Get Request in Flutter:- 'String' can't be assigned to the parameter type 'Uri'

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

问题描述

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

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 中获取请求:- 'String' 不能分配给参数类型 'Uri'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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