Solution 1 :
The getter ‘path’ was called on null.
The error means that the object for which you are writing object.path
is null
. You can use ?.
operator like this: object?.something
which is equivalent to:
object!=null ? object.something : null
Problem :
When I pass pdf URL value to this its getting error with the built-in keyword “path” and it seems to be null?
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;
});
}
}
Comments
Comment posted by github.com/kaisellgren/mailer/issues/89
please check this link