I am new to flutter, I am trying to call this API that displays the params and the response.
So I want to :
- send the params as a string in a post request
- the response will be received as int
- make it in an HTTPS request.
I tried many ways to solve it but my status code is 405 and I didn't get the response as expected, here is my code below:
var response = await http
.post(
Uri.https('url',
'api/Employee/validate_user', {
'domain_name': 'domainName' ,
'user_name': _email,
'password': encodedPassword,
'token': '12345'
}),
)
.then((value) => {
if (value.statusCode == 200)
{debugPrint(value.body)}
else
{
debugPrint(value.statusCode.toString() +
value.body.toString())
}
});
kindly note that the email is retrieved from the textformfield field, and the password is encoded.