UploadFile class

上传文件信息 用于封装文件上传所需的参数

Constructors

UploadFile({File? file, String? filePath, Uint8List? fileBytes, required String fieldName, String? fileName, String? contentType})

Properties

contentType String?
Content-Type(可选,如果不提供则根据文件扩展名自动推断)
final
fieldName String
表单字段名(例如:'avatar', 'images[]')
final
file File?
文件对象(优先使用)
final
fileBytes Uint8List?
文件字节数据(如果未提供 file 和 filePath,则使用此数据)
final
fileName String?
文件名(可选,如果不提供则从 file 或 filePath 中提取)
final
filePath String?
文件路径(如果未提供 file,则使用此路径)
final
hashCode int
The hash code for this object.
no setterinherited
name String
获取文件名
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMultipartFile() Future<MultipartFile>
转换为 Dio 的 MultipartFile 注意:Dio 5.x 的 MultipartFile 不支持直接设置 contentType 参数 Content-Type 会根据文件名自动推断,或由服务器处理
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited