【发布时间】:2020-11-01 14:18:40
【问题描述】:
当我将 pdf URL 值传递给它时,内置关键字“path”会出现错误,它似乎为空?
loadPdf(String pdfPath) async {
setState(() => _isLoading = true);
var fileName = pdfPath.split('/').last;
var localFileUrl = (await Directory(CacheManager.getInstance().appDocumentDir.path +'/'+"realpro"+"/").create(recursive: true)).path +fileName;
if (await CacheManager.getInstance().checkFileExist(localFileUrl)) {
document = await PDFDocument.fromAsset(localFileUrl);
print(document);
setState(() {
_isLoading = false;
});
} else {
document = await PDFDocument.fromURL(pdfPath);
print(document);
setState(() {
_isLoading = false;
});
}
}
【问题讨论】:
标签: android ios flutter dart flutter-layout