MultipartFile constructor
- @Deprecated('MultipartFile() is not cloneable when the stream is consumed, ' 'use 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 it may be inferred from filename
in the future.
Implementation
@Deprecated(
'MultipartFile() is not cloneable when the stream is consumed, '
'use 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');