flutter_pdfview
flutter_pdfview copied to clipboard
how to load pdf from assets when pdf loaded from json file
Hey im struggling with how to load pdf from assets when loaded from json file
You need to load asset file and pass to a file like this example
Future<String> fromAssetToFile(String asset, String filename) async {
try {
var data = await rootBundle.load(asset);
var bytes = data.buffer.asUint8List();
File file = File("${widget.directorio.path}/$filename");
File assetFile;
if (file.existsSync()) {
return file.path;
} else {
assetFile = await file.writeAsBytes(bytes);
return assetFile.path;
}
} catch (e) {
throw Exception('Error parsing asset file! $e');
}
}
Thanks Will try it out 🤘🏼
whats the directorio string..???
whats the directorio string..???
Is from getapplicationdocumentsdirectory() in package path_provider
https://pub.dev/packages/path_provider
okay i cant get it to work... i dont know what im doing hehe
you cant find any build with this its all the same shit load on push on a button whats with that..??
if you make a example you will be the first on the whole internet to do so im pretty sure