download method

Future<int> download(
  1. DownloadOptions options
)

Download a URL. If the URL uses the HTTPS protocol, then the request will include all cookies currently set for its hostname. If both filename and saveAs are specified, then the Save As dialog will be displayed, pre-populated with the specified filename. If the download started successfully, callback will be called with the new DownloadItem's downloadId. If there was an error starting the download, then callback will be called with downloadId=undefined and runtime.lastError will contain a descriptive string. The error strings are not guaranteed to remain backwards compatible between releases. Extensions must not parse it. |options|: What to download and how. |callback|: Called with the id of the new DownloadItem.

Implementation

Future<int> download(DownloadOptions options) async {
  var $res =
      await promiseToFuture<int>($js.chrome.downloads.download(options.toJS));
  return $res;
}