MultipartFile.fromBytes constructor Null safety

MultipartFile.fromBytes(
  1. List<int> value,
  2. {String? filename,
  3. MediaType? contentType}
)

Creates a new MultipartFile from a byte array.

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

Implementation

factory MultipartFile.fromBytes(
  List<int> value, {
  String? filename,
  MediaType? contentType,
}) {
  var stream = Stream.fromIterable([value]);
  return MultipartFile(
    stream,
    value.length,
    filename: filename,
    contentType: contentType,
  );
}