RequestFile class
An uploaded file from a multipart/form-data request.
Small files (up to 1 MB) are kept in memory. Bigger files are streamed to a temp file while the request is read, so a big upload does not fill the RAM. The temp file is deleted when the response is done, so call store or moveTo before you return from the controller.
- Implemented types
Constructors
Properties
-
bytes
→ Future<
Uint8List> -
get file content in bytes.
for a big file this reads the whole file into memory,
so prefer stream, store or moveTo for big files.
no setter
- extension → String
-
Get file extension
eg. png, jpeg, pdf
no setteroverride
- file → File?
-
the file on disk, or null when the file is kept in memory
no setter
- filename → String
-
final
- filetype → String
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
head
→ List<
int> -
the first bytes of the file.
@Mimesand@Imageread the real file type from them.no setteroverride - length → int
-
size of the file in bytes
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
size
→ Future<
num> -
get file size in kilobytes
no setter
Methods
-
moveTo(
String destination) → Future< File> -
move the file to
destinationand return the new file. the first move of a temp file is a cheap rename, later calls copy, so the file can be stored in many places. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
store(
String folder) → Future< String> - this function will store the file in your project storage folder
-
stream(
) → Stream< List< int> > - read the file content as a stream, without loading it all in memory
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited