Click here to Skip to main content
15,888,816 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
In "bb" variable all data show in json format when i debugged. but show this error "HTTP Error 400. The request hostname is invalid". This json data is working in Postman Please Help!!!!


What I have tried:

void send() async
{
var bb=json.encode(listModel.toJson());
    var response = await http.post(Uri.parse(
      "http://10.0.2.2:1066/api/Storedata/Add"),
      body: bb,
     headers: {"Content-type": "application/json"},);
if (response.statusCode == 201)
  {
    print("Done");
  }
else
  {
    print(response.body);
    print(response.statusCode);
  }
}
Posted
Updated 20-Oct-22 0:41am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900