i download a file from a xml playlist, but i want if the file exist flutter_downloader continue with the next file download, how can i do this ?
In this case download and check only the first file in playlist
/// check if have permissions
if(status.isGranted){
/// get playlist of the day
for(var item in lista){
if(item['data'] == formattedDate){
var brani = item['lista']['brano'];
/// get the songs from the playlist
for(var brano in brani){
var db = await openDatabase('download_tasks.db');
var dbRecord = '${brano['md5']}.mp3';
/// check if task table exist
var checkTable = await db.rawQuery("SELECT COUNT(*) as tabs FROM sqlite_master WHERE type='table' AND name='task'");
var numTabs = checkTable.first['tabs'] as int;
/// if table exist download the songs and check if the songs exist
if(numTabs > 0){
var oldFile = await db.rawQuery("SELECT file_name FROM task WHERE file_name='"+dbRecord+"' AND progress = '100';");
List list = await oldFile;
for (var item in list){
if(item['file_name'] == dbRecord){
print('il file ${dbRecord} esiste');
} else {
print('il file ${dbRecord} NON esiste');
await downloadBrani(brano['nome'], brano['md5']);
}
}
} else {
await downloadBrani(brano['nome'], brano['md5']);
}
}
}
}
}else{
print('permission denied');
}
Thank you so much