MultipartFile constructor
- @Deprecated('MultipartFile.clone() will not work when the stream is provided, use the MultipartFile.fromStream instead.' 'This will be removed in 6.0.0')
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
@Deprecated(
'MultipartFile.clone() will not work when the stream is provided, use the MultipartFile.fromStream instead.'
'This will be removed in 6.0.0',
)
MultipartFile(
Stream<List<int>> stream,
this.length, {
this.filename,
DioMediaType? contentType,
Map<String, List<String>>? headers,
}) : _dataBuilder = (() => stream),
headers = caseInsensitiveKeyMap(headers),
contentType = contentType ?? MediaType('application', 'octet-stream');