downloadFile static method
Implementation
static Future<File> downloadFile(String url, {String? progressMsg}) async {
Dio simple = Dio();
Uni.progress(0, progressMsg);
String savePath = Directory.systemTemp.path + '/' + url.split('/').last;
await simple.download(url, savePath,
onReceiveProgress: (int count, int total) {
if (total > 0) {
Uni.progress(count / total, progressMsg);
}
}, options: Options(responseType: ResponseType.bytes));
if (progressMsg == null) {
Uni.hide();
}
return Future.value(File(savePath));
}