Http request sent an empty body
According to post
function document https://pub.dev/documentation/http/latest/http/post.html
If body
is String
, the content-type
of the request will default to "text/plain"
.
If body
is Map
, the content-type
of the request will default to "application/x-www-form-urlencoded"
.
You can set header to application/json
code snippet
http.post(url, headers: {"Content-Type": "application/json"}, body: body