FileDownloader class interface
Provides access to all functions of the plugin in a single place.
Constructors
- FileDownloader({PersistentStorage? persistentStorage})
-
factory
Properties
- database ↔ Database
-
Database where tracked tasks are stored.
latefinal
- downloaderForTesting → BaseDownloader
-
Do not use: for testing only
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- permissions → Permissions
-
Permissions authorization interface
no setter
-
ready
→ Future<
bool> -
True when initialization is complete and downloader ready for use
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
taskQueues
→ List<
TaskQueue> -
List of connected
TaskQueue
sno setter -
updates
→ Stream<
TaskUpdate> -
Stream of
TaskUpdate
updates for downloads that do not have a registered callbackno setter
Methods
-
addTaskQueue(
TaskQueue taskQueue) → void -
Adds the
taskQueue
to this downloader -
allTaskIds(
{String group = defaultGroup, bool includeTasksWaitingToRetry = true}) → Future< List< String> > -
Returns a list of taskIds of all tasks currently active in this
group
-
allTasks(
{String group = defaultGroup, bool includeTasksWaitingToRetry = true}) → Future< List< Task> > -
Returns a list of all tasks currently active in this
group
-
cancelTasksWithIds(
List< String> taskIds) → Future<bool> - Cancel all tasks matching the taskIds in the list
-
cancelTaskWithId(
String taskId) → Future< bool> - Cancel this task
-
configure(
{dynamic globalConfig, dynamic androidConfig, dynamic iOSConfig, dynamic desktopConfig}) → Future< List< (String, String)> > - Configures the downloader
-
configureNotification(
{TaskNotification? running, TaskNotification? complete, TaskNotification? error, TaskNotification? paused, bool progressBar = false, bool tapOpensFile = false, String groupNotificationId = ''}) → FileDownloader - Configure default task notification
-
configureNotificationForGroup(
String group, {TaskNotification? running, TaskNotification? complete, TaskNotification? error, TaskNotification? paused, bool progressBar = false, bool tapOpensFile = false, String groupNotificationId = ''}) → FileDownloader - Configure notification for a group of tasks
-
configureNotificationForTask(
Task task, {TaskNotification? running, TaskNotification? complete, TaskNotification? error, TaskNotification? paused, bool progressBar = false, bool tapOpensFile = false, String groupNotificationId = ''}) → FileDownloader - Configure notification for a single task
-
destroy(
) → void - Destroy the FileDownloader. Subsequent use requires initialization
-
download(
DownloadTask task, {void onStatus(TaskStatus)?, void onProgress(double)?, void onElapsedTime(Duration)?, Duration? elapsedTimeInterval}) → Future< TaskStatusUpdate> -
Download a file and return the final
TaskStatusUpdate
-
downloadBatch(
List< DownloadTask> tasks, {BatchProgressCallback? batchProgressCallback, TaskStatusCallback? taskStatusCallback, TaskProgressCallback? taskProgressCallback, void onElapsedTime(Duration)?, Duration? elapsedTimeInterval}) → Future<Batch> -
Enqueues a list of files to download and returns when all downloads
have finished (successfully or otherwise). The returned value is a
Batch
object that contains the originaltasks
, theresults
and convenience getters to filter successful and failed results. -
enqueue(
Task task) → Future< bool> - Enqueue a new Task
-
getRequireWiFiSetting(
) → Future< RequireWiFi> - Returns the current global setting for requiring WiFi
-
Move the file represented by
filePath
to a shared storagedestination
and potentially adirectory
within that destination. If themimeType
is not provided we will attempt to derive it from thefilePath
extension -
Move the file represented by the
task
to a shared storagedestination
and potentially adirectory
within that destination. If themimeType
is not provided we will attempt to derive it from the Task.filePath extension -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
openFile(
{Task? task, String? filePath, String? mimeType}) → Future< bool> -
Open the file represented by
task
orfilePath
using the application available on the platform. -
Returns the filePath to the file represented by
filePath
in shared storagedestination
and potentially adirectory
within that destination. -
pause(
DownloadTask task) → Future< bool> - Pause the task
-
platformVersion(
) → Future< String> - Return the platform version as a String
-
registerCallbacks(
{String group = defaultGroup, TaskStatusCallback? taskStatusCallback, TaskProgressCallback? taskProgressCallback, TaskNotificationTapCallback? taskNotificationTapCallback}) → FileDownloader - Register status or progress callbacks to monitor download progress, and TaskNotificationTapCallback to respond to user tapping a notification.
-
removeTaskQueue(
TaskQueue taskQueue) → bool -
Removes
taskQueue
and return true if successful -
request(
Request request) → Future< Response> - Perform a server request for this request
-
requireWiFi(
RequireWiFi requirement, {dynamic rescheduleRunningTasks = true}) → Future< bool> -
Set WiFi requirement globally, based on
requirement
. -
reset(
{String group = defaultGroup}) → Future< int> -
Resets the downloader by cancelling all ongoing tasks within
the provided
group
-
resetUpdates(
) → Future< void> - Closes the updates stream and re-initializes the StreamController such that the stream can be listened to again
-
resume(
DownloadTask task) → Future< bool> - Resume the task
-
resumeFromBackground(
) → Future< void> - Wakes up the FileDownloader from possible background state, triggering a stream of updates that may have been processed while in the background, and have not yet reached the callbacks or listener
-
taskCanResume(
Task task) → Future< bool> - Returns true if task can be resumed on pause
-
taskForId(
String taskId) → Future< Task?> -
Return
Task
for the giventaskId
, or null if not found. -
tasksFinished(
{String group = defaultGroup, bool includeTasksWaitingToRetry = true, String? ignoreTaskId}) → Future< bool> -
Returns true if tasks in this
group
are finished -
toString(
) → String -
A string representation of this object.
inherited
-
trackTasks(
{bool markDownloadedComplete = true}) → Future< FileDownloader> - Activate tracking for all tasks
-
trackTasksInGroup(
String group, {bool markDownloadedComplete = true}) → Future< FileDownloader> -
Activate tracking for tasks in this
group
-
unregisterCallbacks(
{String group = defaultGroup, Function? callback}) → FileDownloader - Unregister a previously registered TaskStatusCallback, TaskProgressCallback or TaskNotificationTapCallback.
-
upload(
UploadTask task, {void onStatus(TaskStatus)?, void onProgress(double)?, void onElapsedTime(Duration)?, Duration? elapsedTimeInterval}) → Future< TaskStatusUpdate> -
Upload a file and return the final
TaskStatusUpdate
-
uploadBatch(
List< UploadTask> tasks, {BatchProgressCallback? batchProgressCallback, TaskStatusCallback? taskStatusCallback, TaskProgressCallback? taskProgressCallback, void onElapsedTime(Duration)?, Duration? elapsedTimeInterval}) → Future<Batch> -
Enqueues a list of files to upload and returns when all uploads
have finished (successfully or otherwise). The returned value is a
Batch
object that contains the originaltasks
, theresults
and convenience getters to filter successful and failed results.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- chunkGroup → String
-
Special group name for tasks that download a chunk, as part of a
ParallelDownloadTask
no setter
Constants
- defaultGroup → const String
- If no group is specified the default group name will be used