The total length of the request body, in bytes. This is calculated from fields and files and cannot be set manually.
Source
@override int get contentLength { int length = 0; fields.forEach((String name, String value) { length += "--".length + _BOUNDARY_LENGTH + "\r\n".length + UTF8.encode(_headerForField(name, value)).length + UTF8.encode(value).length + "\r\n".length; }); for (MultipartFile file in _files) { length += "--".length + _BOUNDARY_LENGTH + "\r\n".length + UTF8.encode(_headerForFile(file)).length + file.length + "\r\n".length; } return length + "--".length + _BOUNDARY_LENGTH + "--\r\n".length; }
Source
@override set contentLength(int value) { throw new UnsupportedError("Cannot set the contentLength property of " "multipart requests."); }