length property
int
length
The total length of the request body, in bytes. This is calculated from fields and files and cannot be set manually.
Implementation
int get length {
int length = 0;
for (final entry in fields) {
length += '--'.length +
_boundaryLength +
'\r\n'.length +
utf8.encode(_headerForField(entry.key, entry.value)).length +
utf8.encode(entry.value).length +
'\r\n'.length;
}
for (final file in files) {
length += '--'.length +
_boundaryLength +
'\r\n'.length +
utf8.encode(_headerForFile(file)).length +
file.value.length +
'\r\n'.length;
}
return length + '--'.length + _boundaryLength + '--\r\n'.length;
}