downloadTaskWithRequest method

URLSessionDownloadTask downloadTaskWithRequest(
  1. URLRequest request
)

Creates a URLSessionDownloadTask that downloads the data from a server URL.

Provide a onFinishedDownloading handler in the URLSession factory to receive notifications when the data has completed downloaded.

See NSURLSession downloadTaskWithRequest:

Implementation

URLSessionDownloadTask downloadTaskWithRequest(URLRequest request) {
  final task = URLSessionDownloadTask._(
      _nsObject.downloadTaskWithRequest_(request._nsObject));
  _setupDelegation(_delegate, this, task,
      onComplete: _onComplete,
      onData: _onData,
      onFinishedDownloading: _onFinishedDownloading,
      onRedirect: _onRedirect,
      onResponse: _onResponse);
  return task;
}