uploading image flutter

Solutions on MaxInterview for uploading image flutter by the best coders in the world

showing results for - "uploading image flutter"
David
17 Apr 2020
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);