downloadFile method

Future<File> downloadFile(
  1. String url, {
  2. required String savePath,
  3. required String filename,
})

Implementation

Future<io.File> downloadFile(
  String url, {
  required String savePath,
  required String filename,
}) async {
  final directory = io.Directory(savePath);
  final filePath = join(directory.path, filename);

  await download(url, filePath).then(
    (response) => response.data,
  );
  return io.File(filePath);
}