我正在尝试使用通过我的颤振应用程序上的表单输入的数据来实现将多个图像(以及一些其他数据)上传到 API 的能力。
我正在使用https://pub.dev/packages/multi_image_picker将所有图像存储为List<Asset>
我尝试连接的 API 说它需要以下字段。
firstname, lastname and images[].
我已经开始使用以下方法对 json 正文进行编码:
var body = json.encode({"firstname": firstNameField, "lastname": lastNameField, "images": imageList});
但这失败了。有没有人有什么建议?