-
Notifications
You must be signed in to change notification settings - Fork 143
Just switched from flutter_plugin_pdf_viewer to advance_pdf_viewer, and facing 3 issues #50
Comments
Same for me, using latest flutter version 2.2.1 |
I am having the same problem. I am using flutter version 2.2.1 |
same for me |
1 similar comment
same for me |
I am facing the same issue with flutter v2.2.1 |
I think the problem is due to the import file in the plugin itself. I don't know for sure but the File class object we are passing is from 'dart:io' but in the plugin, the File which it is expecting is abstract class File. |
yes, I saw the problem with the file class too. I added 'as' while importing. My problem is not solved. there is still a problem. |
Came across this issue after upgrading to Flutter 2.2.1 and even the same persisted after downgrading it to 2.2.0. Sol, that worked: Edited the /flutter/.pub-cache/hosted/pub.dartlang.org/advance_pdf_viewer-2.0.0/lib/src/document.dart import 'dart:io'; - > import 'dart:io' as io; : line 2 static Future fromAsset(String asset) async { |
Here's the working pubspec dep for a fork with the change above:
|
This has to be fixed asap. |
Submitted a PR containing the fix- #51. |
This solution doesn't work for me with Flutter 2.2.1
Even with the sample project |
not working on MacOS desktop app |
Requires another change to Line 22: Sadly still not working with Exception |
Just switched from flutter_plugin_pdf_viewer to advance_pdf_viewer, and facing 3 issues while running the app. These are the 3 issues :
../../Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/advance_pdf_viewer-2.0.0/lib/src/document.dart:64:14: Error: The class 'File' is abstract and can't be instantiated.
file = File("${dir.path}/file.pdf");
../../Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/advance_pdf_viewer-2.0.0/lib/src/document.dart:72:26: Error: Non-nullable variable 'file' must be assigned before it can be used.
document._filePath = file.path;
../../Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/advance_pdf_viewer-2.0.0/lib/src/document.dart:75:58: Error: Non-nullable variable 'file' must be assigned before it can be used.
.invokeMethod('getNumberOfPages', {'filePath': file.path});
I am using this code:
`
class _ChapterState extends State {
bool _isLoading = true;
PDFDocument document;
@OverRide
void initState() {
super.initState();
loadDocument();
}
loadDocument() async {
document = await PDFDocument.fromAsset(widget.category.chapter);
setState(() => _isLoading = false);
}
@OverRide
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
appBar: AppBar(
centerTitle: false,
backgroundColor: Theme.of(context).accentColor,
title: Text(
widget.category.name,
),
),
body: Center(
child: _isLoading
? Center(
child: CircularProgressIndicator(),
)
: PDFViewer(document: document),
),
);
}
}
`
Kindly help.
The text was updated successfully, but these errors were encountered: