-1

I am trying to make a post request with dio. The body of my request contains the data with the format indicated in the image

However, a list of objects with key "details" are not processed. Here is my request defenition:

@POST('/v1/some/api')
Future<void> makeRequest(
  @Field("ids") List<int> ids,
  @Field("details") List<Map<String, dynamic>> details,
  @Field("topic") String topic,
);

also tried to do like:

  Future<void> makeRequest(@Body() body);

The API recognizes ids and topic but "details" is not recognized.

1 Answers1

2

Solved question by adding optional @Header property to my request:

Future<void> makeRequest(
  @Body() Map<String, dynamic> body,
  {@Header('Content-Type') String contentType = 'application/json'}
);

passed 'application/json' as a default value