title: Flutter : Create directory on external storage path - path provider getExternalStorageDirectory()
body: <p>I'm creating a flutter app where I want to download and store an image to the external storage (not documents directory) so it can be viewed by any photo gallery app.
  I'm using the following code to create a directory</p>
  
  <pre><code>var dir = await getExternalStorageDirectory();
    if(!Directory("${dir.path}/myapp").existsSync()){
      Directory("${dir.path}/myapp").createSync(recursive: true);
    }
  </code></pre>
  
  <p>It's giving me following error:</p>
  
  <pre><code>FileSystemException: Creation failed, path = '/storage/emulated/0/myapp' (OS Error: Permission denied, errno = 13)
  </code></pre>
  
  <p>I have set up permissions in the manifest file and using the following code for runtime permissions</p>
  
  <pre><code>List&lt;Permissions&gt; permissions = await Permission.getPermissionStatus([PermissionName.Storage]);
  permissions.forEach((p) async {
    if(p.permissionStatus != PermissionStatus.allow){
      final res = await Permission.requestSinglePermission(PermissionName.Storage);
      print(res);
    }
  });
  </code></pre>
  
  <p>I have verified in settings that app has got the permission, also as suggested on some answers here I've also tried giving permission from settings app manually which did not work.</p>