DownloadTask constructor
- String? taskId,
- required String url,
- Map<
String, String> ? urlQueryParameters, - String? filename,
- Map<
String, String> ? headers, - String? httpRequestMethod,
- dynamic post,
- String directory = '',
- BaseDirectory baseDirectory = BaseDirectory.applicationDocuments,
- String group = 'default',
- Updates updates = Updates.status,
- bool requiresWiFi = false,
- int retries = 0,
- bool allowPause = false,
- int priority = 5,
- String metaData = '',
- String displayName = '',
- DateTime? creationTime,
Creates a DownloadTask
taskId
must be unique. A unique id will be generated if omitted
url
properly encoded if necessary, can include query parameters
urlQueryParameters
may be added and will be appended to the url
, must
be properly encoded if necessary
filename
of the file to save. If omitted, a random filename will be
generated
headers
an optional map of HTTP request headers
httpRequestMethod
the HTTP request method used (e.g. GET, POST)
post
if set, uses POST instead of GET. Post must be one of the
following:
- a String: POST request with
post
as the body, encoded in utf8 - a Map: will be jsonEncoded to a String and set as the POST body
- a List of bytes: will be converted to a String using String.fromCharCodes and set as the POST body
- a List: map will be jsonEncoded to a String and set as the POST body
directory
optional directory name, precedes filename
baseDirectory one of the base directories, precedes directory
group if set allows different callbacks or processing for different
groups
updates the kind of progress updates requested
requiresWiFi if set, will not start download until WiFi is available.
If not set may start download over cellular network
retries if >0 will retry a failed download this many times
allowPause if true, allows pause command
priority in range 0 <= priority <= 10 with 0 highest, defaults to 5
metaData user data
displayName human readable name for this task
creationTime
time of task creation, 'now' by default.
Implementation
DownloadTask(
{super.taskId,
required super.url,
super.urlQueryParameters,
super.filename,
super.headers,
super.httpRequestMethod,
super.post,
super.directory,
super.baseDirectory,
super.group,
super.updates,
super.requiresWiFi,
super.retries,
super.allowPause,
super.priority,
super.metaData,
super.displayName,
super.creationTime});