The getDownloadsDirectory function is defined as potentially returning null. The documentation talks about it potentially throwing an UnsupportedError if this is not supported on the current platform, and talks about the returned Directory maybe not existing, but doesn't say when it might return null. So it's not clear if this is a failure mode that one should handle, or what to do when it happens.
https://pub.dev/documentation/path_provider/latest/path_provider/getDownloadsDirectory.html
The
getDownloadsDirectoryfunction is defined as potentially returning null. The documentation talks about it potentially throwing an UnsupportedError if this is not supported on the current platform, and talks about the returned Directory maybe not existing, but doesn't say when it might return null. So it's not clear if this is a failure mode that one should handle, or what to do when it happens.https://pub.dev/documentation/path_provider/latest/path_provider/getDownloadsDirectory.html