getPdfFileFromAssets method
Copies the asset at assetPath to the device's temporary directory and
returns the resulting File.
The file is always written as temp.pdf in the temporary directory,
so it will be overwritten on subsequent calls.
Implementation
Future<File> getPdfFileFromAssets(String assetPath) async {
final byteData = await rootBundle.load(assetPath);
final dir = await getTemporaryDirectory();
final file = File('${dir.path}/temp.pdf');
await file.writeAsBytes(byteData.buffer.asUint8List());
return file;
}