contentType property
Implementation
String? get contentType => headers[Headers.contentTypeHeader];
The request Content-Type. The default value is ContentType.json.
If you want to encode request body with 'application/x-www-form-urlencoded',
you can set ContentType.parse('application/x-www-form-urlencoded')
, and Dio
will automatically encode the request body.
Implementation
set contentType(String? contentType) {
headers[Headers.contentTypeHeader] = contentType?.trim();
}