Flutter: Permission denied writing file
final Io.Directory systemTempDir = Io.Directory.systemTemp;
seems to not work in release mode.
I had to do as below:
Directory tempDir = await getTemporaryDirectory();
final File file = File("${tempDir.path}/$fileName");
getTemporaryDirectory()
is provided by path_provider.
There may be a problem with the paths depending on the device being used. Have a look at the path_provider plugin: https://pub.dartlang.org/packages/path_provider
There's a good write-up of how to read and write files in the Flutter Cookbook on flutter.io: https://flutter.io/cookbook/persistence/reading-writing-files/
In Android Q, just add the Following Lines in AndroidManifest file:
<application
android:requestLegacyExternalStorage="true"