title: Advance PDF Viewer : Failed assertion: line 4263 pos 14: 'owner!._debugCurrentBuildTarget == this': is not true
body: <p>I am getting the error when I try to load the pdf from URL.
  It shows the number of pages of pdf but then error appears on the screen.</p>
  <p><a href="https://i.stack.imgur.com/O8Owp.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/O8Owp.jpg" alt="Screenshot of error" /></a></p>
  <p><a href="https://pub.dev/packages/advance_pdf_viewer" rel="nofollow noreferrer">Using plugin - https://pub.dev/packages/advance_pdf_viewer</a></p>
  <p>Logcat:</p>
  <pre><code>======== Exception caught by widgets library 
  
  =======================================================
  The following _CastError was thrown building NotificationListener&lt;KeepAliveNotification&gt;:
  Null check operator used on a null value
  
  The relevant error-causing widget was: 
    PDFViewer file:///D:/GST%20with%20GT/gst_with_gt/lib/screens/pdfview.dart:70:19
  When the exception was thrown, this was the stack: 
  #0      _PDFPageState._repaint (package:advance_pdf_viewer/src/page.dart:54:45)
  #1      _PDFPageState.didChangeDependencies (package:advance_pdf_viewer/src/page.dart:42:5)
  #2      StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4725:11)
  #3      ComponentElement.mount (package:flutter/src/widgets/framework.dart:4541:5)
  #4      Element.inflateWidget (package:flutter/src/widgets/framework.dart:3603:14)
  ...
  ====================================================================================================
  
  ======== Exception caught by widgets library =======================================================
  The following assertion was thrown building SliverFillViewport:
  'package:flutter/src/rendering/sliver_multi_box_adaptor.dart': Failed assertion: line 258 pos 16: 'child == null || indexOf(child) &gt; index': is not true.
  
  
  Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
  In either case, please report this assertion by filing a bug on GitHub:
    https://github.com/flutter/flutter/issues/new?template=2_bug.md
  
  The relevant error-causing widget was: 
    PDFViewer file:///D:/GST%20with%20GT/gst_with_gt/lib/screens/pdfview.dart:70:19
  When the exception was thrown, this was the stack: 
  #2      RenderSliverMultiBoxAdaptor._debugVerifyChildOrder (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:258:16)
  #3      RenderSliverMultiBoxAdaptor.debugChildIntegrityEnabled=.&lt;anonymous closure&gt; (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:233:14)
  #4      RenderSliverMultiBoxAdaptor.debugChildIntegrityEnabled= (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:235:6)
  #5      SliverMultiBoxAdaptorElement.performRebuild (package:flutter/src/widgets/sliver.dart:1208:20)
  #6      SliverMultiBoxAdaptorElement.update (package:flutter/src/widgets/sliver.dart:1124:7)
  ...
  ====================================================================================================
  
  ======== Exception caught by widgets library =======================================================
  The following assertion was thrown building RawGestureDetector-[LabeledGlobalKey&lt;RawGestureDetectorState&gt;#411e6](state: RawGestureDetectorState#4acaf(gestures: &lt;none&gt;, behavior: opaque)):
  A RenderViewport expected a child of type RenderSliver but received a child of type RenderErrorBox.
  
  RenderObjects expect specific types of children because they coordinate with their children during layout and paint. For example, a RenderSliver cannot be the child of a RenderBox because a RenderSliver does not understand the RenderBox layout protocol.
  The RenderViewport that expected a RenderSliver child was created by: Viewport ← IgnorePointer-[GlobalKey#e5bfe] ← Semantics ← Listener ← _GestureSemantics ← RawGestureDetector-[LabeledGlobalKey&lt;RawGestureDetectorState&gt;#411e6] ← Listener ← _ScrollableScope ← _ScrollSemantics-[GlobalKey#3ad9e] ← RepaintBoundary ← CustomPaint ← RepaintBoundary ← ⋯
  The RenderErrorBox that did not match the expected child type was created by: ErrorWidget-[#87a59] ← SliverFillViewport ← Viewport ← IgnorePointer-[GlobalKey#e5bfe] ← Semantics ← Listener ← _GestureSemantics ← RawGestureDetector-[LabeledGlobalKey&lt;RawGestureDetectorState&gt;#411e6] ← Listener ← _ScrollableScope ← _ScrollSemantics-[GlobalKey#3ad9e] ← RepaintBoundary ← ⋯
  The relevant error-causing widget was: 
    PDFViewer file:///D:/GST%20with%20GT/gst_with_gt/lib/screens/pdfview.dart:70:19
  When the exception was thrown, this was the stack: 
  #0      ContainerRenderObjectMixin.debugValidateChild.&lt;anonymous closure&gt; (package:flutter/src/rendering/object.dart:3134:9)
  #1      ContainerRenderObjectMixin.debugValidateChild (package:flutter/src/rendering/object.dart:3161:6)
  #2      MultiChildRenderObjectElement.insertRenderObjectChild (package:flutter/src/widgets/framework.dart:6127:25)
  #3      RenderObjectElement.attachRenderObject (package:flutter/src/widgets/framework.dart:5737:35)
  #4      RenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5433:5)
  ...
  ====================================================================================================
  
  ======== Exception caught by widgets library =======================================================
  The following assertion was thrown building _ScrollableScope:
  'package:flutter/src/widgets/framework.dart': Failed assertion: line 4263 pos 14: 'owner!._debugCurrentBuildTarget == this': is not true.
  
  
  Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
  In either case, please report this assertion by filing a bug on GitHub:
    https://github.com/flutter/flutter/issues/new?template=2_bug.md
  
  The relevant error-causing widget was: 
    PDFViewer file:///D:/GST%20with%20GT/gst_with_gt/lib/screens/pdfview.dart:70:19
  When the exception was thrown, this was the stack: 
  #2      Element.rebuild.&lt;anonymous closure&gt; (package:flutter/src/widgets/framework.dart:4263:14)
  #3      Element.rebuild (package:flutter/src/widgets/framework.dart:4266:6)
  #4      StatefulElement.update (package:flutter/src/widgets/framework.dart:4771:5)
  #5      Element.updateChild (package:flutter/src/widgets/framework.dart:3345:15)
  #6      SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6057:14)
  ...
  </code></pre>
  <p>Here, my code :</p>
  <pre><code>class PdfViewers extends StatefulWidget {
  
    @override
    PdfViewersState createState() =&gt; PdfViewersState();
  }
  
      class PdfViewersState extends State&lt;PdfViewers&gt; {
        bool _isLoadings = true;
        PDFDocument docs;
      
      
        @override
        void initState() {
          Timer(
            Duration(seconds: 1),
            () =&gt; loadUrl(),
          );
          super.initState();
        }
      
        @override
        Widget build(BuildContext context) {
          return Scaffold(
              backgroundColor: Colors.grey[100],
              appBar: AppBar(
                elevation: 0,
                backgroundColor: Colors.grey[100],
                actions: [
                  
                  IconButton(
                      icon: Icon(
                        Icons.share_rounded,
                        color: Color(0xff4f2e7f),
                      ),
                      onPressed: () async {}),
                ],
                title: Text(
                  'PDF Article',
                  softWrap: true,
                  style: TextStyle(color: Color(0xff4f2e7f)),
                ),
                leading: IconButton(
                    onPressed: () {
                      Navigator.pop(context, true);
                    },
                    icon: Icon(Icons.arrow_back_outlined, color: Color(0xff4f2e7f))),
              ),
              body: Center(
                  child: _isLoadings
                      ? Container(child: CircularProgressIndicator())
                      : PDFViewer(document: docs)));
        }
      
        Future&lt;void&gt; loadUrl() async {
          setState(() {
            _isLoadings = true;
          });
      
          docs= await PDFDocument.fromURL(
              'https://gstwithgt.fivestake.com/uploads/topics/16254191793470.pdf');
      
          setState(() {
            _isLoadings = false;
          });
        }
      
  
  
  }
  </code></pre>
  <p>I tried and searched many tutorials and example but none of them are working for me. so I posted question here.</p>
  <p>The main thing is when I paste this same code in another project then it is working fine. I don't know where the problem is.. I'm trying to solve this error since last two days..</p>