I have used Dio package to download a file as below :
Future<void> downloadFile() async {
// requests permission for downloading the file
bool hasPermission = await _requestWritePermission();
if (!hasPermission) return;
Dio dio = Dio();
try {
var dir = await getApplicationDocumentsDirectory();
await dio.download(uri, "${dir.path}/eng_json.json",
onReceiveProgress: (rec, total) {
print("Path >>> " + "${dir.path}/eng_json.json");
setState(() {
downloading = true;
});
});
} catch (e) {
print("Error >> " + e.toString());
}
setState(() {
downloading = false;
print("Download Completes");
});
}
But I have to download multiple files. Is there any support in Dio package to download multiple files? Or Any other better way to handle downloading multiple files in Flutter application?