writeToFile method

Future<int> writeToFile(
  1. File file
)

Downloads the object into file and returns its size in bytes: startDownloadToFile without the controls, so it resumes after a network failure the same way.

When the download fails, the partial file is deleted, file is left untouched and the error is thrown.

Implementation

Future<int> writeToFile(File file) async {
  final DownloadTask task = startDownloadToFile(file);
  await task.result;
  return task.bytesTransferred;
}