length property

int get length

The length of the request body from this FormData

Implementation

int get length {
  var length = 0;

  for (final item in fields) {
    length += '--'.length +
        _maxBoundaryLength +
        '\r\n'.length +
        utf8.encode(_fieldHeader(item.key, item.value)).length +
        utf8.encode(item.value).length +
        '\r\n'.length;
  }

  for (var file in files) {
    length += '--'.length +
        _maxBoundaryLength +
        '\r\n'.length +
        utf8.encode(_fileHeader(file)).length +
        file.value.length! +
        '\r\n'.length;
  }

  return length + '--'.length + _maxBoundaryLength + '--\r\n'.length;
}