未处理的异常:SocketException:操作系统错误:连接被拒绝,errno = 111,地址= 127.0.0.1,端口= 40712

问题描述 投票:0回答:1
Future<User> registerUser(String username, String firstname, String lastname, String password, String email) 
      async {
        print("\n\n\n\n\n\n\nHello\n\n\n\n\n\n\n\n");
        final response = await client
            .post('http://127.0.0.1:5000/api/register', // the error exists here
            // headers: "", 
            body: jsonEncode({
              "emailaddress": email,
              "username": username,
              "password": password,
              "first_name": firstname,
              "last_name": lastname
            })
          );

我尝试将<uses-permission android:name="android.permission.INTERNET"/>添加到清单中,并在模拟器上更改代理。谢谢

android flutter android-emulator
1个回答
0
投票

对于本地主机-我将IP从127.0.0.1更改为10.0.2.2,并且可以正常工作。

© www.soinside.com 2019 - 2024. All rights reserved.