How to use this library to show a PDF when this screen is opened in FlutterHow can I open a URL in Android's web browser from my application?How to align views at the bottom of the screen?How do I add a library project to Android Studio?Flutter - Implementing a Navigation drawer with a TabBarView widget with dynamic Tab viewHow do I insert widgets at the top of a ListView?How to offset a scaffold widget in Flutter?Flutter : Bad state: Stream has already been listened toHow to change parent's state from another Widget/Modal (not necessarily a page)How to insert blob (response from server) into ngx-extended-pdf-viewer?Flutter - Builder null on navigation push

What is Soda Fountain Etiquette?

How do I portray irrational anger in first person?

Was a six-engine 747 ever seriously considered by Boeing?

Why do IR remotes influence AM radios?

In Endgame, wouldn't Stark have remembered Hulk busting out of the stairwell?

I feel cheated by my new employer, does this sound right?

Do universities maintain secret textbooks?

How to handle inventory and story of a player leaving

Scaling arrows.meta with tranform shape

Do manacles provide any sort of in-game mechanical effect or condition?

Did the Apollo Guidance Computer really use 60% of the world's ICs in 1963?

'Horseshoes' for Deer?

Where should I draw the line on follow up questions from previous employer

Are sweatpants frowned upon on flights?

How to save money by shopping at a variety of grocery stores?

Pen test results for web application include a file from a forbidden directory that is not even used or referenced

What checks exist against overuse of presidential pardons in the USA?

Is it possible for a person to be tricked into becoming a lich?

Do multi-engine jets need all engines with equal age to reduce asymmetry in thrust and fuel consumption arising out of deterioration?

having problems with greek characters in a table using csvsimple

Why did the population of Bhutan drop by 70% between 2007 and 2008?

Count the number of triangles

How can I reply to coworkers who accuse me of automating people out of work?

basename "$0" not working



How to use this library to show a PDF when this screen is opened in Flutter


How can I open a URL in Android's web browser from my application?How to align views at the bottom of the screen?How do I add a library project to Android Studio?Flutter - Implementing a Navigation drawer with a TabBarView widget with dynamic Tab viewHow do I insert widgets at the top of a ListView?How to offset a scaffold widget in Flutter?Flutter : Bad state: Stream has already been listened toHow to change parent's state from another Widget/Modal (not necessarily a page)How to insert blob (response from server) into ngx-extended-pdf-viewer?Flutter - Builder null on navigation push






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have a pdf_screen.dart file that will show a PDF directly when opened, does anyone can explain me how to use the functions of this library called flutter pdf viewer just to show my pdf?



Flutter PDF Viewer Library Example



 class _PdfScreenState extends State<PdfScreen> 

final DocumentSnapshot document;
String path;
var dir;

_PdfScreenState(this.document);


@override
void initState()
super.initState();
getPdf();


Future<void> getPdf() async
try
dir = await getApplicationDocumentsDirectory();
setState(()
path = "$dir.path/$document["title"].pdf";
);
catch (e)
print(e);




@override
Widget build(BuildContext context)

if (path == null)


print("loading");
return Container(
color: Colors.white,
child: Center(
child: CircularProgressIndicator(backgroundColor: Colors.blueAccent,
),
),
);
else

return Container(
child: ??; // I need to show my PDF here, I need to pass the path
// variable but PdfViewer is a function and it doesn't
// return a widget, how to implement?












share|improve this question
































    0















    I have a pdf_screen.dart file that will show a PDF directly when opened, does anyone can explain me how to use the functions of this library called flutter pdf viewer just to show my pdf?



    Flutter PDF Viewer Library Example



     class _PdfScreenState extends State<PdfScreen> 

    final DocumentSnapshot document;
    String path;
    var dir;

    _PdfScreenState(this.document);


    @override
    void initState()
    super.initState();
    getPdf();


    Future<void> getPdf() async
    try
    dir = await getApplicationDocumentsDirectory();
    setState(()
    path = "$dir.path/$document["title"].pdf";
    );
    catch (e)
    print(e);




    @override
    Widget build(BuildContext context)

    if (path == null)


    print("loading");
    return Container(
    color: Colors.white,
    child: Center(
    child: CircularProgressIndicator(backgroundColor: Colors.blueAccent,
    ),
    ),
    );
    else

    return Container(
    child: ??; // I need to show my PDF here, I need to pass the path
    // variable but PdfViewer is a function and it doesn't
    // return a widget, how to implement?












    share|improve this question




























      0












      0








      0








      I have a pdf_screen.dart file that will show a PDF directly when opened, does anyone can explain me how to use the functions of this library called flutter pdf viewer just to show my pdf?



      Flutter PDF Viewer Library Example



       class _PdfScreenState extends State<PdfScreen> 

      final DocumentSnapshot document;
      String path;
      var dir;

      _PdfScreenState(this.document);


      @override
      void initState()
      super.initState();
      getPdf();


      Future<void> getPdf() async
      try
      dir = await getApplicationDocumentsDirectory();
      setState(()
      path = "$dir.path/$document["title"].pdf";
      );
      catch (e)
      print(e);




      @override
      Widget build(BuildContext context)

      if (path == null)


      print("loading");
      return Container(
      color: Colors.white,
      child: Center(
      child: CircularProgressIndicator(backgroundColor: Colors.blueAccent,
      ),
      ),
      );
      else

      return Container(
      child: ??; // I need to show my PDF here, I need to pass the path
      // variable but PdfViewer is a function and it doesn't
      // return a widget, how to implement?












      share|improve this question
















      I have a pdf_screen.dart file that will show a PDF directly when opened, does anyone can explain me how to use the functions of this library called flutter pdf viewer just to show my pdf?



      Flutter PDF Viewer Library Example



       class _PdfScreenState extends State<PdfScreen> 

      final DocumentSnapshot document;
      String path;
      var dir;

      _PdfScreenState(this.document);


      @override
      void initState()
      super.initState();
      getPdf();


      Future<void> getPdf() async
      try
      dir = await getApplicationDocumentsDirectory();
      setState(()
      path = "$dir.path/$document["title"].pdf";
      );
      catch (e)
      print(e);




      @override
      Widget build(BuildContext context)

      if (path == null)


      print("loading");
      return Container(
      color: Colors.white,
      child: Center(
      child: CircularProgressIndicator(backgroundColor: Colors.blueAccent,
      ),
      ),
      );
      else

      return Container(
      child: ??; // I need to show my PDF here, I need to pass the path
      // variable but PdfViewer is a function and it doesn't
      // return a widget, how to implement?









      android pdf dart flutter






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 28 at 9:23









      Zoe

      15.6k12 gold badges65 silver badges96 bronze badges




      15.6k12 gold badges65 silver badges96 bronze badges










      asked Mar 27 at 22:15









      djalmafreestylerdjalmafreestyler

      749 bronze badges




      749 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          0















          As the readme says, this library launches a new intent, so it replaces your Flutter app in the stack until you use the back button. The example is clear how to achieve this.



          However, as the readme continues, a proof-of-concept is available allowing you to render the PDF inside your Flutter app. Check out the branch from github to explore more.




          A proof of concept for inline PDFs is available at the inline branch.







          share|improve this answer

























          • I don't understand where to call PdfViewer.load...without an onpressed:, my screen will open and need to show the pdf directly.

            – djalmafreestyler
            Mar 27 at 22:48











          • At the end of getPdf looks likely. Alternatively do it instead of navigating to this page.

            – Richard Heap
            Mar 27 at 23:26











          • Thank you, it worked.

            – djalmafreestyler
            Mar 27 at 23:40










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55387304%2fhow-to-use-this-library-to-show-a-pdf-when-this-screen-is-opened-in-flutter%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0















          As the readme says, this library launches a new intent, so it replaces your Flutter app in the stack until you use the back button. The example is clear how to achieve this.



          However, as the readme continues, a proof-of-concept is available allowing you to render the PDF inside your Flutter app. Check out the branch from github to explore more.




          A proof of concept for inline PDFs is available at the inline branch.







          share|improve this answer

























          • I don't understand where to call PdfViewer.load...without an onpressed:, my screen will open and need to show the pdf directly.

            – djalmafreestyler
            Mar 27 at 22:48











          • At the end of getPdf looks likely. Alternatively do it instead of navigating to this page.

            – Richard Heap
            Mar 27 at 23:26











          • Thank you, it worked.

            – djalmafreestyler
            Mar 27 at 23:40















          0















          As the readme says, this library launches a new intent, so it replaces your Flutter app in the stack until you use the back button. The example is clear how to achieve this.



          However, as the readme continues, a proof-of-concept is available allowing you to render the PDF inside your Flutter app. Check out the branch from github to explore more.




          A proof of concept for inline PDFs is available at the inline branch.







          share|improve this answer

























          • I don't understand where to call PdfViewer.load...without an onpressed:, my screen will open and need to show the pdf directly.

            – djalmafreestyler
            Mar 27 at 22:48











          • At the end of getPdf looks likely. Alternatively do it instead of navigating to this page.

            – Richard Heap
            Mar 27 at 23:26











          • Thank you, it worked.

            – djalmafreestyler
            Mar 27 at 23:40













          0














          0










          0









          As the readme says, this library launches a new intent, so it replaces your Flutter app in the stack until you use the back button. The example is clear how to achieve this.



          However, as the readme continues, a proof-of-concept is available allowing you to render the PDF inside your Flutter app. Check out the branch from github to explore more.




          A proof of concept for inline PDFs is available at the inline branch.







          share|improve this answer













          As the readme says, this library launches a new intent, so it replaces your Flutter app in the stack until you use the back button. The example is clear how to achieve this.



          However, as the readme continues, a proof-of-concept is available allowing you to render the PDF inside your Flutter app. Check out the branch from github to explore more.




          A proof of concept for inline PDFs is available at the inline branch.








          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 27 at 22:36









          Richard HeapRichard Heap

          12.7k2 gold badges17 silver badges30 bronze badges




          12.7k2 gold badges17 silver badges30 bronze badges















          • I don't understand where to call PdfViewer.load...without an onpressed:, my screen will open and need to show the pdf directly.

            – djalmafreestyler
            Mar 27 at 22:48











          • At the end of getPdf looks likely. Alternatively do it instead of navigating to this page.

            – Richard Heap
            Mar 27 at 23:26











          • Thank you, it worked.

            – djalmafreestyler
            Mar 27 at 23:40

















          • I don't understand where to call PdfViewer.load...without an onpressed:, my screen will open and need to show the pdf directly.

            – djalmafreestyler
            Mar 27 at 22:48











          • At the end of getPdf looks likely. Alternatively do it instead of navigating to this page.

            – Richard Heap
            Mar 27 at 23:26











          • Thank you, it worked.

            – djalmafreestyler
            Mar 27 at 23:40
















          I don't understand where to call PdfViewer.load...without an onpressed:, my screen will open and need to show the pdf directly.

          – djalmafreestyler
          Mar 27 at 22:48





          I don't understand where to call PdfViewer.load...without an onpressed:, my screen will open and need to show the pdf directly.

          – djalmafreestyler
          Mar 27 at 22:48













          At the end of getPdf looks likely. Alternatively do it instead of navigating to this page.

          – Richard Heap
          Mar 27 at 23:26





          At the end of getPdf looks likely. Alternatively do it instead of navigating to this page.

          – Richard Heap
          Mar 27 at 23:26













          Thank you, it worked.

          – djalmafreestyler
          Mar 27 at 23:40





          Thank you, it worked.

          – djalmafreestyler
          Mar 27 at 23:40








          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55387304%2fhow-to-use-this-library-to-show-a-pdf-when-this-screen-is-opened-in-flutter%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript