I'm trying to do a dio post request and I need to specify the body as raw-data Post
Response response = await (await init()).post(url, data: {
"token": token,
"code": formol}
);
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>
CodePudding user response:
Try to encode it as a Json:
var json = {
"code": "xxxxxxxxx",
"token": "-------------",
};
...
Response response = await _dio.post(url,
options: Options(headers: {
HttpHeaders.contentTypeHeader: "application/json",
}),
data: jsonEncode(json),
);