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"/>
添加到清单中,并在模拟器上更改代理。谢谢
对于本地主机-我将IP从127.0.0.1更改为10.0.2.2,并且可以正常工作。