Git Product home page Git Product logo

Comments (7)

endigo avatar endigo commented on June 9, 2024 1

Hello, you can check using built-in method from dart:io

import "dart:io"

String path = "filepath.pdf";

File(path).exists();

from flutter_pdfview.

l-k22 avatar l-k22 commented on June 9, 2024 1

you can implement your own file extension check before you execute the exists() function, then return a warning to the user like an alert dialog to say incorrect file type.
https://api.flutter.dev/flutter/package-path_path/extension.html

from flutter_pdfview.

endigo avatar endigo commented on June 9, 2024 1

@l-k22 Thank you for your suggestion. Feel free to create PR.

from flutter_pdfview.

ShashankSirmour avatar ShashankSirmour commented on June 9, 2024

i mean if the file is epub or another format it crashes all the application so I think its better to check the file format in package side

from flutter_pdfview.

ShashankSirmour avatar ShashankSirmour commented on June 9, 2024

I tried all the pdf packages they are not crashing but they are not better than this package this package is really very beautiful and highly customizable thank you for the great package

from flutter_pdfview.

ShashankSirmour avatar ShashankSirmour commented on June 9, 2024

Hello, you can check using built-in method from dart:io

import "dart:io"

String path = "filepath.pdf";

File(path).exists();

i mean format like epub or other it crashes when the file is not pdf

from flutter_pdfview.

l-k22 avatar l-k22 commented on June 9, 2024

@l-k22 Thank you for your suggestion. Feel free to create PR.

I made a fork and edited the example to to include a simple snackbar that prevents a non pdf file being opened.
I decided to only do edit the example as the developer may have their own design specification on how to handle alerts (an alert dialog might be too intrusive).
PR submitted.

from flutter_pdfview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.