FormData formData = FormData.fromMap({ "name": "wendux", "age": 25, "file": await MultipartFile.fromFile("./text.txt",filename: "upload.txt"), "files": [ await MultipartFile.fromFile("./text1.txt", filename: "text1.txt"), await MultipartFile.fromFile("./text2.txt", filename: "text2.txt"), ] }); response = await dio.post("/info", data: formData); // var resJson = convert.jsonDecode(res); // 字符串反序列化为Map
Flutter 之网络请求Dio, FormData, 表单网络请求, x-www-form-urlencoded
Flutter 之网络请求Dio, FormData, 表单网络请求, x-www-form-urlencoded表单网络请求示例: