pdf_viewer_plugin 0.0.4

  • README.md
  • Example
  • Installing
  • Versions
  • 83


A new Flutter plugin to view pdfs

Getting Started

For help getting started with Flutter, view our online documentation.

For help on editing plugin code, view the documentation.

[0.0.1] - TODO: Add release date.

  • TODO: Describe initial release.


import 'dart:async';
import 'dart:io';
import 'dart:typed_data';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:pdf_viewer_plugin/pdf_viewer_plugin.dart';
import 'package:path_provider/path_provider.dart';
import 'package:http/http.dart' as http;

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  _MyAppState createState() => new _MyAppState();

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';

  initState() {

  Future<String> get _localPath async {
    final directory = await getApplicationDocumentsDirectory();

    return directory.path;

  Future<File> get _localFile async {
    final path = await _localPath;
    return new File('$path/teste.pdf');

  Future<File> writeCounter(Uint8List stream) async {
  final file = await _localFile;
  // Write the file
  return file.writeAsBytes(stream);

  Future<bool> existsFile() async {
  final file = await _localFile;
  return file.exists();
  Future<Uint8List> fetchPost() async {
  final response =
      await http.get('https://expoforest.com.br/wp-content/uploads/2017/05/exemplo.pdf');
  final responseJson = response.bodyBytes;

  return responseJson;

  initPlatformState() async {
    String platformVersion;
    try {

      writeCounter(await fetchPost());
      var x = await existsFile();
      PdfViewerPlugin.getPdfViewer((await _localFile).path, 80.0, 200.0, 200.0);

    } on PlatformException {
      platformVersion = 'Failed to get platform version.';

    if (!mounted)

    setState(() {
      _platformVersion = platformVersion;

  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('Plugin example app'),
        body: new Center(
          child: new Column(children: <Widget>[
              new Text("Hello"),
              new RaisedButton(
                child: new Text("Clique aqui"),
                onPressed: initPlatformState
              new RaisedButton(
                  child: new Text("close"),
                  onPressed: () { PdfViewerPlugin.close(); }

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  pdf_viewer_plugin: ^0.0.4

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:pdf_viewer_plugin/pdf_viewer_plugin.dart';
Version Uploaded Documentation Archive
0.0.5 Aug 30, 2018 Go to the documentation of pdf_viewer_plugin 0.0.5 Download pdf_viewer_plugin 0.0.5 archive
0.0.4 Jun 23, 2018 Go to the documentation of pdf_viewer_plugin 0.0.4 Download pdf_viewer_plugin 0.0.4 archive
0.0.3 Jun 22, 2018 Go to the documentation of pdf_viewer_plugin 0.0.3 Download pdf_viewer_plugin 0.0.3 archive
0.0.2 Jun 16, 2018 Go to the documentation of pdf_viewer_plugin 0.0.2 Download pdf_viewer_plugin 0.0.2 archive
0.0.1 Jun 14, 2018 Go to the documentation of pdf_viewer_plugin 0.0.1 Download pdf_viewer_plugin 0.0.1 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jan 15, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.10
  • Flutter: 1.1.7


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/pdf_viewer_plugin.dart. (-0.50 points)

Analysis of lib/pdf_viewer_plugin.dart reported 1 hint:

line 2 col 8: Unused import: 'dart:ui'.

Maintenance suggestions

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Package is pre-v0.1 release. (-10 points)

While there is nothing inherently wrong with versions of 0.0.*, it usually means that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.19.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8