Why does sending formData with dio keeps sending instance of image path

41 Views Asked by At

I want to update profile details. I have name and an image field to put in the formData. When I send the data this is the log of the Patch request [log] ApiService - PATCH REQUEST DATA:: [MapEntry(fullName: Abunga Methoo), MapEntry(profilePic: Instance of 'Future')]

`try {

  final mimeTypeData =
      lookupMimeType(pickedImagePath.value, headerBytes: [0xFF, 0xD8])!
          .split('/');

  dio.FormData data = dio.FormData.fromMap(({
    "files": await dio.MultipartFile.fromFile(
      pickedImagePath.value,
      filename: pickedImageName.value,
      contentType: MediaType(mimeTypeData[0], mimeTypeData[1]),
    ),
    'fullName': fullNameController.text
  }));

final result = await userService.updateProfile(payload: data); I dont think i should be getting instance of file path as i am already awaiting the multifilePart. I am just tired already

` this is the method for the formData. i am expecting the log to come out with the user name and obviously the string of the filepath to be sent to the backend but i keep getting instance of file path see log:: in this image is the code breakingpoint where i can see the file paht is down the trail, but at the top level is just its instance.[log] ApiService - PATCH REQUEST DATA:: [MapEntry(fullName: Abunga Methoo), MapEntry(profilePic: Instance of 'Future')]

0

There are 0 best solutions below