downloadFile function
Implementation
Future<String?> downloadFile(
{required String url, String? savePath, bool loading = true}) async {
if (!BaseEasyLoading.isShow) {
if (loading) {
showLoading();
}
}
var file = await _downloadFile(url: url);
if (file == null) {
if (loading) {
dismissLoading();
}
return null;
}
final path = savePath ?? await url.crateNewSharePath;
logDebug("download url: $url path: $path");
await file.copy(path);
if (loading) {
dismissLoading();
}
return path;
}