downloadFile function

Future<bool> downloadFile(
  1. String url,
  2. String subdir
)

Implementation

Future<bool> downloadFile(String url, String subdir) async {
  final response = await http.get(Uri.parse(url));
  if (response.statusCode == 200) {
    final bytes = response.bodyBytes;
    final file = File("$subdir/chrome-win.zip");
    await file.writeAsBytes(bytes);
    return true;
  }
  return false;
}