This is My Flutter Code--
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);
}
}
In "bb" variable all data show in json format when i debugged. but show this error "HTTP Error 400. The request hostname is invalid". Please Help!!!!
CodePudding user response:
try adding https instead of http
CodePudding user response:
can you please use Dio package?