formDataToJson method
Implementation
Map<String, dynamic> formDataToJson(FormData formData) {
final map = <String, dynamic>{};
for (final entry in formData.fields) {
map[entry.key] = entry.value;
}
for (final file in formData.files) {
var responseString = "[application/octet-stream; ";
if (file.value.filename != null) {
responseString += "filename=${file.value.filename}; ";
}
responseString += "length=${file.value.length}]";
map[file.key] = responseString;
}
return map;
}