Skip to content

SfPdfViewer throws error when used inside a nested Navigator #2366

Open
@LiangShaing

Description

@LiangShaing

Hi Syncfusion team,

I'm encountering an issue when wrapping SfPdfViewer.memory inside a nested Navigator. When I try to use built-in features like page navigation, I consistently receive the following error:

Failed assertion: line 5646 pos 12: '_history.isNotEmpty': is not true.

Here's a simplified version of the code:

Navigator( key: navigationPossKey, onGenerateInitialRoutes: (navigatorState, initialRoute) { return [ MaterialPageRoute( builder: (context) => Builder( builder: (context) { return SfPdfViewer.memory( _pdfBytes!, ); }, ), ) ]; }, )

I suspect the internal use of Navigator within the PDF viewer is conflicting with the custom navigation context created by the nested Navigator. This causes the internal history stack to behave unexpectedly or break altogether.

Would it be possible to improve support for nested navigators or expose some options to disable internal navigation behavior? Alternatively, is there a recommended approach for using SfPdfViewer inside a tab/page structure with a nested navigator?

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions