You can't send json encoded string with multipart, you have to do it formdata way, you may need to update your backend code
final req = http.MultipartRequest('POST', url);
// Write your add files statement here
req.fields['id'] = id; // This is your id field
req.fields['details[name]'] = Name; // This is name field in details object
req.fields['details[attribute][boundaryOpacity]'] = boundaryOpacity; // This is how you write nested fields
You can follow same pattern for other fields as well, you need to implment a check for null field, assuming id can be null, write it as follows
req.fields['id'] = id != null ? id : ''; // If it is null convert it to empty string or don't include it
Alternate solution
Add a data field and convert entire payload to json string and decode at backend.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…