Closed MohaAmiry closed 1 week ago
This is intended because every field would be converted to String
in a FormData
. Fields are converted recursively so you'll see location[address]
. You should probably add jsonEncode
for the value of location
and bankCard
to make it explicitly a string type.
ref: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest_API/Using_FormData_Objects
@AlexV525 i know, i ended up building the FormData
by hand and used jsonEncoder
. the issue is the expected output from formData.fromMap
is to handle the objects correctly instead of forcing the user to build the formData manually when an object exists in the form.
Package
dio
Version
5.4.1
Operating-System
Android
Adapter
Default Dio
Output of
flutter doctor -v
Dart Version
3.3.4
Steps to Reproduce
1- get a map object like:
Expected Result
the expected parsed value when
print(form.fields)
is:notice the
location
andbankCard
values were parsed as jsons.Actual Result
the actual result when
print(form.fields)
is:notice the
location
andbankCard
fields were parsed independently in a different format. this causes NullReferenceExceptions when passed to a .NET backend.