I'm using universal html package which is same as the dart:html package but work with multiple platforms. From that I'm making this http POST request to my local XAMPP server.
Future newConn() async {
try {
await html.HttpRequest.postFormData(
'http://192.166.6.150/test.php',
{'firstName': 'John', 'lastName': 'Doe'},
).then(
(value) => print("completed$value"),
);
;
} on Exception {
print("error");
}
}
In here $value is the httpResponse object. But when I run the above script flutter gives me "Instance of 'ProgressEvent' " error. I have tried this on my local emulator and chrome both. My php is as below.
test.php
<?php
$nameF = $_POST["firstName"];
$nameSec = $_POST["lastName"];
echo $nameF;
exit();
?>