MultipartFile constructor

  1. String field,
  2. Stream<List<int>> stream,
  3. int length,
  4. {String filename,
  5. 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.


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