I am trying to upload an image in flutter using dio package but it doesn't work and I've tested the api using postman and it worked the image got uploaded any idea how to make it work.
This is a code snippet of my upload function
void editMyProfile({
String? username,
String? birthdate,
dynamic photo,
}) async {
emit(EditMyProfileLoadingState());
try {
await DioHelper.patchData(
token: "Token $token",
url: "$profileEndPoint$userId/",
data: {
"name": username,
"date_of_birth": birthdate,
"photo": photo,
},
);
profileName = username!;
profileBirthdate = birthdate!;
showToast(
text: "Profile updated successfully", state: ToastStates.success);
emit(EditMyProfileSuccessState());
} on DioError catch (e) {
if (e.response == null) return;
print(e.response!.data);
emit(EditMyProfileErrorState());
}
}