Comments (7)
Hello, you can check using built-in method from dart:io
import "dart:io"
String path = "filepath.pdf";
File(path).exists();
from flutter_pdfview.
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.
@l-k22 Thank you for your suggestion. Feel free to create PR.
from flutter_pdfview.
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.
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.
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 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)
- Donwload the pdf
- Memory Leak HOT 3
- Single page alignment
- NullPointerException
- 5 E/FrameEvents(16866): updateAcquireFence: Did not find frame. [log] java.io.FileNotFoundException: No content provider: "https://firebasestorage.googleapis.com/..."
- this application, or a library it uses, has passed an invalid numeric value HOT 1
- Missing zoom level option HOT 1
- Missing namespace (AGP 8.0)
- The signature of the pdf file is not fully displayed on the Android phone
- Memory leak
- Fatal Exception: java.lang.IllegalStateException HOT 2
- Package broken on Android with Flutter version 3.16.0 HOT 4
- [IOS] swipe not working if the PDFView in a scrollable widget HOT 2
- java.io.FileNotFoundException: No content provider (Android) HOT 2
- Invalid numeric value (NaN, or not-a-number) to CoreGraphics API HOT 1
- Looking for maintainer HOT 1
- [iOS] Are there any plans to add Privacy Manifests? HOT 2
- Addressing Background Color and Alignment Issues in Flutter iOS PDF Display HOT 1
- Execution failed for task ':app:mergeAppDebugNativeLibs'. HOT 2
- Feature request: Password protected files on Android
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_pdfview.