【问题标题】:Why can't I put a string in the http.post method after update http package in flutter为什么我在flutter中更新http包后不能在http.post方法中放一个字符串
【发布时间】:2021-06-04 00:27:58
【问题描述】:

在我将 http 包更新到版本 0.13.0 后,我的 IP 地址无法使用 http.post() 方法

错误:无法将参数类型“String”分配给参数类型“Uri”。

但在以前的版本中,我可以使用字符串作为我的 uri,没有任何问题,或者我应该使用某种方法将其转换为 Uri 类型而不是字符串?

enter image description here

enter image description here

【问题讨论】:

标签: android flutter android-studio http flutter-dependencies


【解决方案1】:

参数应该是Uri 而不是String

要将您的字符串解析为 URI,您可以这样做:Uri.parse(my_string)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-12-25
    • 2011-09-13
    • 1970-01-01
    • 2016-08-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多