MultipartFile.fromStream constructor
MultipartFile.fromStream(})
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
.
Implementation
MultipartFile.fromStream(
Stream<List<int>> Function() data,
this.length, {
this.filename,
DioMediaType? contentType,
Map<String, List<String>>? headers,
}) : _dataBuilder = data,
headers = caseInsensitiveKeyMap(headers),
contentType = contentType ?? MediaType('application', 'octet-stream');