I need to upload a list of attachments inside an array with this structure:
[
'description' => ['sometimes', 'string'],
'attachments' => ['sometimes', 'array'],
'attachments.*.file' => ['required', 'file'],
]
I'm using package http, and to upload files only allow me to put inside 'files', i'm using this code and it works to upload a file inside files, but I need that structure.
if (json != null) {
request.fields.addAll(json);
}
for (var item in filesPath) {
request.files.add(await http.MultipartFile.fromPath(
'file',
item,
));
}
There is any way to achieve this with this plugin ?