From 7cfd1dcf83b467ef0c3affe623f92d3d490f0855 Mon Sep 17 00:00:00 2001 From: Michele Zonca Date: Fri, 9 Jan 2026 18:54:24 +0100 Subject: [PATCH] Refactor type casting for PdfNumber in destination Add additional check to avoid > type 'PdfNull' is not a subtype of type 'PdfNumber?' in type cast --- .../src/pdf/implementation/general/pdf_named_destination.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/syncfusion_flutter_pdf/lib/src/pdf/implementation/general/pdf_named_destination.dart b/packages/syncfusion_flutter_pdf/lib/src/pdf/implementation/general/pdf_named_destination.dart index 69333f7da..8bec82482 100644 --- a/packages/syncfusion_flutter_pdf/lib/src/pdf/implementation/general/pdf_named_destination.dart +++ b/packages/syncfusion_flutter_pdf/lib/src/pdf/implementation/general/pdf_named_destination.dart @@ -135,8 +135,8 @@ class PdfNamedDestination implements IPdfWrapper { _destination!.mode = PdfDestinationMode.fitH; } } else if (mode.name == 'XYZ' && destination.count > 3) { - final PdfNumber? left = destination[2] as PdfNumber?; - final PdfNumber? top = destination[3] as PdfNumber?; + final PdfNumber? left = (destination[2] is PdfNumber) ? destination[2] as PdfNumber : null; + final PdfNumber? top = (destination[3] is PdfNumber) ? destination[3] as PdfNumber : null; PdfNumber? zoom; if (destination.count > 4 && destination[4] is PdfNumber) { zoom = destination[4]! as PdfNumber;