title: PDF file not opening in release version of android in flutter
body: <p>In Android Studio Emulator, the pdf file is opening but when I release its .apk file and install it on my phone, pdf file does not open. I used flutter_pdfview package to load pdf file.</p>
  
  <p>This is where the page is shown.</p>
  
  <pre><code>import 'package:darpandentalhome/services/api_for_report.dart';
  import 'package:darpandentalhome/shared/loading.dart';
  import 'package:flutter/cupertino.dart';
  import 'package:flutter/material.dart';
  import 'package:flutter_pdfview/flutter_pdfview.dart';
  import 'package:google_fonts/google_fonts.dart';
  
  class Report extends StatefulWidget {
  
    final String url;
  
    Report({this.url});
  
    @override
    _ReportState createState() =&gt; _ReportState();
  }
  
  class _ReportState extends State&lt;Report&gt; {
  
    String path;
  
    @override
    void initState() {
      // TODO: implement initState
      super.initState();
      ApiService(pdfURL: widget.url).loadPDF().then((value){
        setState(() {
          path=value;
        });
      });
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(
          elevation: 0,
          centerTitle: true,
          title: Text(
              'Report',
            style: GoogleFonts.rubik(
              textStyle: TextStyle(
                color: Colors.black,
                fontWeight: FontWeight.w500
              )
            ),
          ),
          leading: IconButton(
              icon: Icon(Icons.arrow_back_ios,color: Colors.black,),
            onPressed: () {
                Navigator.pop(context);
            },
          ),
          backgroundColor: Color(0xfff9f9f9),
        ),
        backgroundColor: Color(0xfff9f9f9),
        body: path != null ? Container(
          child: PDFView(
            filePath: path,
          ),
        ) : Loading(),
        floatingActionButton: IconButton(
          icon: Icon(Icons.refresh,size: 30,),
          onPressed: () {
            setState(() {
              path = null;
              ApiService(pdfURL: widget.url).loadPDF().then((value){
                setState(() {
                  path=value;
                });
              });
            });
          },
        ),
      );
    }
  }
  </code></pre>
  
  <p>This is for the HTTP API service for fetching pdf file from HTTP URL.</p>
  
  <pre><code>import 'dart:io';
  
  import 'package:http/http.dart' as http;
  import 'package:path_provider/path_provider.dart';
  
  class ApiService{
  
    final String pdfURL;
  
    ApiService({this.pdfURL});
  
    Future&lt;String&gt; loadPDF() async {
      var response = await http.get(pdfURL);
      var dir = await getExternalStorageDirectory();
      File file = File(dir.path + "/data.pdf");
      await file.writeAsBytes(response.bodyBytes, flush: true);
      return file.path;
    }
  
  }
  </code></pre>
  
  <p>I thought it was a permission issue of the phone then I used storage permission in AndroidManifest file then manually allowed this permission on my phone but it also didn't work.
  What is the problem here?</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&gt;
  &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/&gt;
  </code></pre>