title: Unable to open pdf file in flutter
body: <p>I want to open a <code>pdf</code> file using <a href="https://pub.dev/packages/open_file" rel="nofollow noreferrer">open_file</a> package.</p>
  <pre><code>OpenFile.open('/data/user/0/xxx/app_flutter/ABC-2745.pdf20200818-5566-1byemw9.pdf');
  </code></pre>
  <p><strong>Error</strong></p>
  <pre><code>E/flutter ( 9713): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(error, Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.PackageItemInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference, null)
  </code></pre>
  <p><strong>Edit</strong></p>
  <p>I get the url from server, and store it in local</p>
  <pre><code>generatePDF(dynamic value) async {
      print(value);
      final filename = value.substring(value.lastIndexOf(&quot;/&quot;) + 1);
      var request = await HttpClient().getUrl(Uri.parse(value));
      var response = await request.close();
      var bytes = await consolidateHttpClientResponseBytes(response);
      String dir = (await getApplicationDocumentsDirectory()).path;
      File file = new File('$dir/$filename.pdf');
      await file.writeAsBytes(bytes);
      print(file.path);
      try {
        OpenFile.open(file.path);
      } catch (e) {
        print(e.toString());
      }
    }
  </code></pre>
  <p><strong>Output</strong></p>
  <pre><code>I/flutter (11889): https://xxx/uploads/organization_file/ABC-2745.pdf20200818-5566-1byemw9
  I/flutter (11889): /data/user/0/xxx/app_flutter/ABC-2745.pdf20200818-5566-1byemw9.pdf
  E/flutter (11889): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(error, Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.PackageItemInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference, null)
  E/flutter (11889): #0      StandardMethodCodec.decodeEnvelope 
  </code></pre>