UploadedFile class
Represents an uploaded file in a multipart request.
Handles file metadata, storage location, and efficient file operations (saving, reading, deleting).
Constructors
Properties
- contentType → String?
-
final
-
data
→ List<
int> -
Gets the file content as bytes.
Warning: This reads the entire file into memory if it's stored on disk.
no setter
- extension → String
-
Gets the file extension (including dot).
no setter
- extensionWithoutDot → String
-
Gets the file extension (without dot).
no setter
- fieldName → String
-
final
- filename → String
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isDiskBased → bool
-
Checks if file is stored on disk.
no setter
- isMemoryBased → bool
-
Checks if file is stored in memory.
no setter
- mimeType → String?
-
Gets the MIME type if available.
no setter
- nameWithoutExtension → String
-
Gets the filename without extension.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size → int
-
Gets the file size in bytes.
no setter
- tempPath → String?
-
Gets the temporary file path if available.
no setter
Methods
-
asString(
[Encoding encoding = utf8]) → String - Gets the file content as a string (if it's text).
-
copyTo(
String path) → Future< String> - Copies the file to a new location.
-
deleteTempFile(
) → Future< void> - Deletes the temporary file if it exists.
-
isMimeType(
String type) → bool - Checks if the file has a specific MIME type.
-
move(
String directory, {String? name}) → Future< String> - Moves the file to a new directory.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
saveTo(
String path) → Future< String> - Saves the file to the specified path. Efficiently moves the temp file if available, otherwise writes bytes.
-
toMap(
) → Map< String, dynamic> - Gets file details as a map.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited