getDownloadDirectory function
Gets the path to the external storage directory for downloads based on the platform.
return A Future that completes with a String representing the path to the downloads directory.
Returns null if the path retrieval fails or is not applicable on the current platform.
throws Exception If an error occurs during the path retrieval process.
-
On Android, this method uses the platform-specific channel to invoke a native method ('getExternalStoragePublicDirectory') and retrieves the path to the external storage downloads directory based on the specified folder type
_androidDownloadsFolderType. -
On iOS, the method returns the Directory to the ApplicationDocumentsDirectory.
-
On macOS, the method returns the Directory to the Downloads directory.
-
On Windows, the method uses the Windows-specific path provider to retrieve the Directory to the Downloads directory.
Implementation
Future<Directory> getDownloadDirectory() =>
DownloadsfolderPlatform.instance.getDownloadFolder();