contentLength property
Gets the content length of the request. If the size of the request is not known in advance, the content length should be null.
Implementation
@override
int get contentLength => bodyBytes.length;
Sets the content length of the request body. This is only supported in streamed requests since the body may be sent asynchronously after the headers have been sent.
Implementation
@override
set contentLength(int? length) {
throw UnsupportedError(
'The content-length of a request cannot be set manually when the request body is known in advance.');
}