MultiUploadTask class final
Information related to an UploadTask, containing multiple files to upload
An equality test on a UploadTask is a test on the taskId only - all other fields are ignored in that test
A MultiUploadTask is initialized with a list representing the files to upload.
Each element is either a filename/path, or a (fileField, filename/path),
or a (fileField, filename/path, mimeType).
When instantiating a MultiUploadTask, this list is converted into
three lists: fileFields, filenames, and mimeTypes, available
as fields. These lists are also encoded to a JSON string representation in
the fields fileField, filename and mimeType,so - different from
a single UploadTask - these fields now contain a JSON object representing all
files.
filename/path means either a filename without directory (and the
directory will be based on the Task.baseDirectory
and Task.directory
fields), or you specify a full file path. For example: "hello.txt" or
"/data/com.myapp/data/dir/hello.txt"
- Inheritance
-
- Object
- Request
- Task
- UploadTask
- MultiUploadTask
Constructors
-
MultiUploadTask({String? taskId, required String url, Map<
String, String> ? urlQueryParameters, required List files, Map<String, String> ? headers, String? httpRequestMethod, Map<String, String> ? fields = const {}, String directory = '', BaseDirectory baseDirectory = BaseDirectory.applicationDocuments, String group = 'default', Updates updates = Updates.status, bool requiresWiFi = false, int priority = 5, int retries = 0, String metaData = '', String displayName = '', DateTime? creationTime}) - Creates UploadTask
-
MultiUploadTask.fromJson(Map<
String, dynamic> json) -
Creates MultiUploadTask object from
json
Properties
- allowPause → bool
-
If true, task will pause if the task fails partly through the execution,
when some but not all bytes have transferred, provided the server supports
partial transfers. Such failures are typically temporary, eg due to
connectivity issues, and may be resumed when connectivity returns.
If false, task fails on any issue, and task cannot be paused
finalinherited
- baseDirectory → BaseDirectory
-
Base directory
finalinherited
- creationTime → DateTime
-
Time at which this request was first created
finalinherited
- directory → String
-
Optional directory, relative to the base directory
finalinherited
- displayName → String
-
Human readable name for this task - use {displayName} in notification
finalinherited
-
fields
→ Map<
String, String> -
Map of name/value pairs to encode as form fields in a multi-part upload.
To specify multiple values for a single name, format the value as
'"value1", "value2", "value3"' so that it matches the following
RegEx: ^(?:"
^"
+"\s*,\s*)+"^"
+"$finalinherited - fileField → String
-
For MultiUploadTask, returns jsonEncoded list of fileFields
no setteroverride
-
fileFields
→ List<
String> -
final
- filename → String
-
For MultiUploadTask, returns jsonEncoded list of filenames
no setteroverride
-
filenames
→ List<
String> -
final
- group → String
-
Group that this task belongs to
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
-
headers
→ Map<
String, String> -
potential additional headers to send with the request
finalinherited
- hostName → String
-
Hostname represented by the url. Throws FormatException if url cannot
be parsed, and returns empty string if no host in url
no setterinherited
- httpRequestMethod → String
-
HTTP request method to use
finalinherited
- metaData → String
-
User-defined metadata - use {metaData} in notification
finalinherited
- mimeType → String
-
For MultiUploadTask, returns jsonEncoded list of mimeTypes
no setteroverride
-
mimeTypes
→ List<
String> -
final
- post → String?
-
Set post to make the request using POST instead of GET.
In the constructor, post must be one of the following:
finalinherited
- priority → int
-
Priority of this task, relative to other tasks.
Range 0 <= priority <= 10 with 0 being the highest priority.
Not all platforms will have the same actual granularity, and how
priority is considered is inconsistent across platforms.
finalinherited
- providesProgressUpdates → bool
-
If true, task expects progress updates
no setterinherited
- providesStatusUpdates → bool
-
If true, task expects status updates
no setterinherited
- requiresWiFi → bool
-
If true, will not download over cellular (metered) network
finalinherited
- retries → int
-
Maximum number of retries the downloader should attempt
finalinherited
- retriesRemaining ↔ int
-
Number of retries remaining
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- taskId → String
-
Identifier for the task - auto generated if omitted
finalinherited
- taskType → String
-
Returns the type of task as a String
no setteroverride
- updates → Updates
-
Type of progress updates desired
finalinherited
- url → String
-
String representation of the url, urlEncoded
finalinherited
-
validHttpMethods
→ List<
String> -
finalinherited
Methods
-
compareTo(
dynamic other) → int -
Returns this.priority - other.priority if not the same
Returns this.creationTime - other.creationTime if priorities the same
Returns 0 if other is not a Task
inherited
-
copyWith(
{String? taskId, String? url, String? filename, Map< String, String> ? headers, String? httpRequestMethod, Object? post, String? fileField, String? mimeType, Map<String, String> ? fields, String? directory, BaseDirectory? baseDirectory, String? group, Updates? updates, bool? requiresWiFi, int? priority, int? retries, int? retriesRemaining, bool? allowPause, String? metaData, String? displayName, DateTime? creationTime}) → MultiUploadTask -
Returns a copy of the Task with optional changes to specific fields
override
-
decreaseRetriesRemaining(
) → void -
Decrease retriesRemaining by one
inherited
-
extractFilesData(
) → Future< List< (String, String, String)> > -
Returns a list of fileData elements, one for each file to upload.
Each element is a triple containing fileField, full filePath, mimeType
inherited
-
filePath(
{String? withFilename}) → Future< String> -
Returns the absolute path to the file represented by this task
based on the Task.filename (default) or
withFilename
inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
Creates JSON map of this object
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited