pdf_viewer_plugin 1.0.0+2

  • Readme
  • Changelog
  • Example
  • Installing
  • 96

Pdf Viewer Plugin #

pub package

A Flutter plugin for IOS and Android providing a simple way to display PDFs.

Features: #

  • Display PDF.

android ........... ios

Installation #

First, add pdf_viewer_plugin as a dependency in your pubspec.yaml file.

iOS #

Add one row to the ios/Runner/info.plist:



You need to

Example #

Here is an example flutter app.

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

import 'package:flutter/material.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(MyApp());

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

class _MyAppState extends State<MyApp> {
  String path;

  initState() {

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

    return directory.path;

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

  Future<File> writeCounter(Uint8List stream) async {
    final file = await _localFile;

    // Write the file
    return file.writeAsBytes(stream);

  Future<Uint8List> fetchPost() async {
    final response = await http.get(
    final responseJson = response.bodyBytes;

    return responseJson;

  loadPdf() async {
    writeCounter(await fetchPost());
    path = (await _localFile).path;

    if (!mounted) return;

    setState(() {});

  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('Plugin example app'),
        body: Center(
          child: Column(
            children: <Widget>[
              if (path != null)
                  height: 300.0,
                  child: PdfViewer(
                    filePath: path,
                Text("Pdf is not Loaded"),
                child: Text("Load pdf"),
                onPressed: loadPdf,

Feedback welcome and Pull Requests are most welcome!

[1.0.0+2] - 17/09/2019

  • Remove unused codes and improve description

[1.0.0+1] - 12/09/2019

  • Fix: Bug when open on ios real device

[1.0.0] - 01/09/2019

  • Update to use platform view


pdf_viewer_plugin_example #

Demonstrates how to use the pdf_viewer_plugin plugin.

Getting Started #

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

Use this package as a library

1. Depend on it

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

  pdf_viewer_plugin: ^1.0.0+2

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub 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';
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 21, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4
  • Flutter: 1.12.13+hotfix.5


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
pedantic ^1.8.0+1