不能将参数类型“String”分配给参数类型“Uri”。扑

时间:2021-04-04 17:21:12

标签: php android mysql flutter

我遇到了麻烦,为什么我的应用程序 flutter 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,
 });

enter image description here

1 个答案:

答案 0 :(得分:3)

您现在需要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,
 });