String body

The body of the request as a string. This is converted to and from bodyBytes using encoding.

When this is set, if the request does not yet have a Content-Type header, one will be added with the type text/plain. Then the charset parameter of the Content-Type header (whether new or pre-existing) will be set to encoding if it wasn't already set.

Source

String get body => encoding.decode(bodyBytes);
void body=(String value)

Source

set body(String value) {
  bodyBytes = encoding.encode(value);
  MediaType contentType = _contentType;
  if (contentType == null) {
    _contentType = new MediaType("text", "plain", <String, String>{'charset': encoding.name});
  } else if (!contentType.parameters.containsKey('charset')) {
    _contentType = contentType.change(parameters: <String, String>{'charset': encoding.name});
  }
}