title: Flutter path_provider error on Android, while on iOS works perfectly
body: <p>I'm using the [<code>flutter_pdfview</code>][1] package in my Flutter app, in order to present PDF files downloaded from the internet. I use the <code>path_provider</code> package to download the file and store it in the devicee.</p>
  <p>Both packages works perfectly fine when running the app on iOS, but when I run it on Android (inside Android emulator in VSCode) it seems the <code>path_provider</code> isn't able to load the file.</p>
  <p>In the console I get this error message:</p>
  <p><code>[onError, {error: java.io.FileNotFoundException: No content provider: thisIsMyFilePath}]</code></p>
  <p>I am downloading and saving the file like this:</p>
  <pre><code>Future&lt;File&gt; getFileFromUrl(String url, {name}) async {
      var fileName;
  
      if (name != null) {
        fileName = name;
      }
  
      try {
        var data = await http.get(url);
        var bytes = data.bodyBytes;
        var dir = await getApplicationDocumentsDirectory();
        File file = File(&quot;${dir.path}/&quot; + fileName + &quot;.pdf&quot;);
        print(dir.path);
        File urlFile = await file.writeAsBytes(bytes);
        return urlFile;
      } catch (e) {
        throw Exception(&quot;Error opening url file&quot;);
      }
  }
  </code></pre>
  <p>Anyone has an idea what can be the Android-only error here? Maybe I need to add something to the manifest I am not aware of?</p>
  <p>Thank you very much!
  [1]: <a href="https://pub.dev/packages/flutter_pdfview" rel="nofollow noreferrer">https://pub.dev/packages/flutter_pdfview</a></p>
  <p><strong>Edit: Alberto Miola answer</strong></p>
  <pre><code>var data = await http.get(url);
        var bytes = data.bodyBytes;
        var dir = await getApplicationDocumentsDirectory();
        final name = p.join(dir.path, fileName + &quot;.pdf&quot;);//From Alberto Miola's answer
        File file = File(name);
        print(dir.path);
        File urlFile = await file.writeAsBytes(bytes);
        return urlFile;
      } catch (e) {
        throw Exception(&quot;Error opening url file&quot;);
  </code></pre>