I\'m trying to make an post request in flutter with content type as url encoded. When I write body : json.encode(data), it encodes to plain text.
If I
you need to use json.encode
example;
var match = {
"homeTeam": {"team": "Team A"},
"awayTeam": {"team": "Team B"}
};
var response = await post(Uri.parse(url),
headers: {
"Accept": "application/json",
"Content-Type": "application/x-www-form-urlencoded"
},
body: json.encode(match),
encoding: Encoding.getByName("utf-8"));