json method
Sets the body to value encoded as JSON, and Content-Type: application/json unless headers already have a content type.
Implementation
void json(Object? value) {
_content = jsonEncode(value);
headers.putIfAbsent(
HttpHeaders.contentTypeHeader,
() => MediaType.applicationJson,
);
}