pdf_viewer_plugin 0.0.5

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 84

pdf_viewer_plugin

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.

example/lib/main.dart

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 {
  @override
  _MyAppState createState() => new _MyAppState();
}

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

  @override
  initState() {
    super.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, 320.0, 600.0);

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

    if (!mounted)
      return;

    setState(() {
      _platformVersion = platformVersion;
    });
  }

  @override
  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:


dependencies:
  pdf_viewer_plugin: ^0.0.5

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
Popularity:
Describes how popular the package is relative to other packages. [more]
81
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
84
Learn more about scoring.

We analyzed this package on Nov 14, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.6
  • Flutter: 0.11.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

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.

Dependencies

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
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8