I'm trying to make a POST request using dart's http package with json data as the body, I'm using a variable of type dynamic to create the json object and so far it works perfectly as long as all the values in the object are strings.
If I assign the value of a property to be an int
or List<int>
(expecting it to be converted to an array, as expected by the server) dart crashes due to expecting either a Map<String, String>
or a List<int>
as the type for the body (the exact type it expects is dynamic, but it tries to cast it to Map<String, String>
or List<int>
).
My question is, is there any workaround to making a http POST request in dart using a object with dynamic property values?