fluttercommunity / fluttercommunity/flutter_downloader

IOS downloaded file not present in the File system.

Open
#163 7 comments 0 reactions 0 assignees View on GitHub
feature request
Dominant language
Kotlin
Stars
940
Forks
561
Avg merge
1h 18m
Merged PRs (30d)
1

Description

Hi,
I used the flutter_downloader package for both Android and IOS. In Android the download is happening without any issue and when download is completed it displays on notification tray. But in IOS I am facing issue, when the download is completed I didn't got any notification and also the downloaded file is not present in the file manager of ipad. Is there any separate code to be done for making the downloaded file available in ipad's or iphone's file manager?

Here is my code for more details :
``` void downloadData() async {
String user = serverdata['username'].toString();
String pass = serverdata['password'].toString();
final directory = await getApplicationDocumentsDirectory();
String basicAuth = 'Basic ' + base64Encode(utf8.encode('$user:$pass'));
print(
"starting to download");
print( directory.path.toString()+" directory path");

Map requestHeaders = {
'Authorization': basicAuth,
};

final taskId = await FlutterDownloader.enqueue(
url: downloadUrl,
savedDir: directory.path,
fileName: downloadname,
headers: requestHeaders,
showNotification: true,
openFileFromNotification: true,
);

print("starting to download "+taskId.toString());

FlutterDownloader.registerCallback(downloadCallback);
FlutterDownloader.loadTasks();
}

static void downloadCallback(String id, DownloadTaskStatus status, int progress) {
Fluttertoast.showToast(
msg: "Download in Progress " + progress.toString(),
textColor: Colors.black,
toastLength: Toast.LENGTH_SHORT,
timeInSecForIos: 1,
gravity: ToastGravity.BOTTOM,
backgroundColor: Colors.white,
);

print("callback id %"+id );
print("callback status %"+ status.toString());
print("callback progress%"+progress.toString());

if(status.toString() == 'DownloadTaskStatus(3)')
{
Fluttertoast.showToast(
msg: "Download finished.",
textColor: Colors.black,
toastLength: Toast.LENGTH_SHORT,
timeInSecForIos: 1,
gravity: ToastGravity.BOTTOM,
backgroundColor: Colors.white,
);

}
else if(status.toString() == 'DownloadTaskStatus(4)'){
Fluttertoast.showToast(
msg: "Download Failed.",
textColor: Colors.black,
toastLength: Toast.LENGTH_SHORT,
timeInSecForIos: 1,
gravity: ToastGravity.BOTTOM,
backgroundColor: Colors.white,
);
}
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.