getDownloadsDirectory function
Path to the directory where downloaded files can be stored.
The returned directory is not guaranteed to exist, so clients should verify that it does before using it, and potentially create it if necessary.
Throws an UnsupportedError if this is not supported on the current platform.
Implementation
Future<Directory?> getDownloadsDirectory() async {
final String? path = await _platform.getDownloadsPath();
if (path == null) {
return null;
}
return Directory(path);
}