MultipartFile(String field, Stream<List<int>> stream, int length, { String filename, MediaType contentType })

Creates a new MultipartFile from a chunked Stream of bytes. The length of the file in bytes must be known in advance. If it's not, read the data from the stream and use MultipartFile.fromBytes instead.

contentType currently defaults to application/octet-stream, but in the future may be inferred from filename.

Source

MultipartFile(this.field, Stream<List<int>> stream, this.length,
    {this.filename, MediaType contentType})
  : this._stream = toByteStream(stream),
    this.contentType = contentType != null ? contentType :
        new MediaType("application", "octet-stream");