1 var d = "$tmpFile";
2 var dd = d.split("'");
3 var filename = dd[1].split('/').last;
4 FormData formData = new FormData.fromMap({
5 "user_id": "3225",
6 "image": await MultipartFile.fromFile(dd[1], filename: "$filename"),
7 });
8 var response = await dio.post(
9 'http://10.0.2.2/test/upload.php',
10 data: formData,
11 onSendProgress: (received, total) {
12 if (total != -1) {
13 print((received / total * 100).toStringAsFixed(0) + "%");
14 }
15 },
16 );
17 print(response);