How to fix "FileSystemException: Cannot open file" in flutter when reading and writing files?
You can use package https://pub.dev/packages/path_provider
And write your file to tempPath
or appDocPath
Directory tempDir = await getTemporaryDirectory();String tempPath = tempDir.path;Directory appDocDir = await getApplicationDocumentsDirectory();String appDocPath = appDocDir.path;
For Android , In AndroidManifest.xml
, you can add permission
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/><uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>