saveToDownloads static method
Android: copies sourcePath into the public Downloads collection through MediaStore
(or the legacy public directory below API 29). Returns the resulting content URI.
This copies a file that is already on the device. To download a URL into Downloads use
UDownloadManager.instance.download(url), which downloads and then calls this for you.
Implementation
static Future<String?> saveToDownloads({
required String sourcePath,
required String fileName,
String? mimeType,
String? subfolder,
}) {
if (sourcePath.startsWith("http://") || sourcePath.startsWith("https://")) {
throw ArgumentError.value(
sourcePath,
"sourcePath",
"must be a local file path, not a URL. Use UDownloadManager.instance.download(url) to download into Downloads",
);
}
return _call<String>("saveToDownloads", <String, Object?>{
"sourcePath": sourcePath,
"fileName": fileName,
"mimeType": _mime(mimeType),
"subfolder": subfolder,
});
}