title: flutter saves the file in the directory selected by the user
body: <p>I use <code>file_picker</code> to get the directory path and <code>permission_handler</code> to get the storage permission, but when I finally save the file, it still fails. I don’t know where the problem is, I use Android</p>
  <pre class="lang-dart prettyprint-override"><code>import 'dart:io';
  
  import 'package:flutter/material.dart';
  import 'package:file_picker/file_picker.dart';
  import 'package:permission_handler/permission_handler.dart';
  import 'package:http/http.dart' as http;
  import 'package:path/path.dart' as path;
  
  
          onPressed: () async {
            var storageStatus = await Permission.storage.status;
            if (storageStatus != PermissionStatus.granted) {
              storageStatus = await Permission.storage.request();
              if (storageStatus != PermissionStatus.granted) {
                return;
              }
            }
  
            var dpath = await FilePicker.platform.getDirectoryPath();
            if (dpath != null) {
              var p = path.join(dpath, 'test.jpg');
              try {
                var r = await http.readBytes(
                    'https://i.loli.net/2019/12/07/vVfLEsQy7TbehrW.jpg');
                try {
                  await File(p).writeAsBytes(r);
                } catch (er) {
                  print('save error: ' + er.message); // save error: Cannot open file
                  print('save path: ' + p); // save path: /storage/emulated/0/.Android/test.jpg
                  print(er); // FileSystemException: Cannot open file, path = '/storage/emulated/0/.Android/test.jpg' (OS Error: Permission denied, errno = 13)
  
                }
              } catch (er) {
                print('download errro: ' + er.message);
              }
            }
          },
  </code></pre>
  <p>pubspec.yaml:</p>
  <pre class="lang-yaml prettyprint-override"><code>environment:
    sdk: &quot;&gt;=2.7.0 &lt;3.0.0&quot;
  
  dependencies:
    flutter:
      sdk: flutter
    path:
    file_picker: 2.0.7
    permission_handler: ^5.0.1+1
    http:
  </code></pre>
  <pre class="lang-sh prettyprint-override"><code>flutter doctor -v
  [√] Flutter (Channel stable, 1.22.4, on Microsoft Windows [Version 10.0.19041.630], locale zh-CN)
      • Flutter version 1.22.4 at D:\my-tools\flutter
      • Framework revision 1aafb3a8b9 (12 days ago), 2020-11-13 09:59:28 -0800
      • Engine revision 2c956a31c0
      • Dart version 2.10.4
      • Pub download mirror https://pub.flutter-io.cn
      • Flutter download mirror https://storage.flutter-io.cn
  
  
  [!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
      • Android SDK at D:\my-tools\Android\sdk
      • Platform android-30, build-tools 29.0.3
      • ANDROID_HOME = D:\my-tools\Android\sdk
      • Java binary at: D:\my-tools\Android\AndroidStudio\jre\bin\java
      • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
      X Android license status unknown.
        Run `flutter doctor --android-licenses` to accept the SDK licenses.
        See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
  
  [!] Android Studio (version 4.1.0)
      • Android Studio at D:\my-tools\Android\AndroidStudio
      X Flutter plugin not installed; this adds Flutter specific functionality.
      X Dart plugin not installed; this adds Dart specific functionality.
      • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
  
  [√] Connected device (1 available)
      • SM G8750 (mobile) • c5976a52 • android-arm64 • Android 10 (API 29)
  </code></pre>