【问题标题】:The argument type 'String' can't be assigned to the parameter type 'Uri'. Flutter参数类型“String”不能分配给参数类型“Uri”。扑
【发布时间】:2021-06-30 18:41:47
【问题描述】:

我遇到了麻烦,为什么我在我的应用程序中出现此错误 main.dart 我只是按照这个参考link。如果有人能弄清楚,那就太好了,在此先感谢您!

这是错误部分

Future<List> _login() async {
   final response = await http.post("http://10.0.2.2/my_store/login.php", body: {
      "username": user.text,
      "password": pass.text,
 });

【问题讨论】:

    标签: php android mysql flutter


    【解决方案1】:

    你现在需要parse你的网址,像这样使用它:

    Future<List> _login() async {
       final response = await http.post(Uri.parse("http://10.0.2.2/my_store/login.php"), body: {
          "username": user.text,
          "password": pass.text,
     });
    

    【讨论】:

      猜你喜欢
      • 2021-06-19
      • 2021-10-17
      • 2021-11-23
      • 2021-06-27
      • 1970-01-01
      • 2021-10-02
      • 2021-10-06
      • 2020-04-15
      相关资源
      最近更新 更多