Skip to content

Conversation

@michelezonca
Copy link

Hi everyone,
I ran into the following runtime error when accessing a bookmark destination (from a namedDestination):

type 'PdfNull' is not a subtype of type 'PdfNumber?' in type cast

Unfortunately I cann't share the original PDF (probably malformed), but it opens correctly on other viewers.

This PR fixes the issue by adding a simple defensive type check before casting the destination value to PdfNumber, preventing invalid casts when the destination contains PdfNull (or anything else)

Add additional check to avoid 
> type 'PdfNull' is not a subtype of type 'PdfNumber?' in type cast
@immankumarsync immankumarsync added pdf PDF component open Open labels Jan 12, 2026
@immankumarsync
Copy link
Collaborator

Hi @michelezonca,

Thank you for sharing your proposal and providing the patch to resolve the typecasting issue when accessing the destination of a PdfBookmark that contains PdfNull.

We are currently reviewing the proposed change. We will address this issue, and it will be included in the weekly release scheduled for January 27, 2026.

Please note that, although the Flutter PDF library source code is publicly available on GitHub for transparency, we do not accept direct contributions to the repository. This policy ensures consistency and quality across all releases. Nevertheless, your feedback and suggestions are highly valued, and we encourage you to continue sharing ideas through our official support channels.

Thank you for your understanding and continued support.

Regards,
Imman Kumar P

@immankumarsync immankumarsync added follow-up scheduled Follow-up scheduled and removed open Open labels Jan 14, 2026
@michelezonca
Copy link
Author

Thanks @immankumarsync, sure, I do understand your policy. Feel free to close this or take the usual actions.

I'll wait for that release to update my pubspec and remove my local fork

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

follow-up scheduled Follow-up scheduled pdf PDF component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants