Skip to content

FileDownloadTask

Downloads a file from CAWS to a local file in the background.

Created and started by FileStorageReference.download. onComplete completes after a successful HTTP response and the start of the local write; it does not wait for the write to finish.

Inheritance

Properties

file

File file
getter/setter pair

The file on the local device which this task is downloading to. The file has to be created before starting the download.

onComplete

Future<int> get onComplete

Completes with the HTTP status code (200) when the download succeeds.

Completes with an error for an unsuccessful HTTP response whose error body can be decoded, or if the task is canceled. Other failures are not consistently forwarded here and may leave this future pending.

Methods

cancel

void cancel()
override

Cancels the download task and completes onComplete with an error (408 Request Timeout).