so I'm trying to work with download manager in flutter using flutter_downloader package. I manage to make my app download the file I wanted. How can I make my app more advance ? I wanted my app to be able to open the downloaded file automatically when the download is done.
Another question is, if I already download the file first time how can I make the button trigger to open the file location rather than downloading the file again ?
Here's my current code:
TextButton(
child: Text(
ticketData['file_attachment_map'][index]['name'],
style: primaryColor600Style.copyWith(fontSize:14.sp),
),
onPressed: () async {
final permissionStatus = await Permission.storage.request();
if (permissionStatus.isGranted) {
final externalDir = await getExternalStorageDirectory();
final taskId =await FlutterDownloader.enqueue(
url: ticketData['file_attachment_map']
[index]['url'],
savedDir:externalDir!.path,
showNotification:true,
openFileFromNotification:true,
);
} else {
print('Permission denied');
}
},
),