title: PageView NoSuchMethodError was thrown during performLayout()
body: <p>i'm building my first flutter application and i have this problem that i can't figure out.</p>
  
  <p>The app retrieve data from a firebase realtime database, add all the entries in a list, and show all the entries in the first page of a PageView.</p>
  
  <p>When i launch app in debug mode i have the following error:</p>
  
  <pre><code>I/flutter ( 7901): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
  I/flutter ( 7901): The following NoSuchMethodError was thrown during performLayout():
  I/flutter ( 7901): The getter 'key' was called on null.
  I/flutter ( 7901): Receiver: null
  I/flutter ( 7901): Tried calling: key
  I/flutter ( 7901): User-created ancestor of the error-causing widget was:
  I/flutter ( 7901):   PageView-[#62d48] file:///home/amedeo/AndroidStudioProjects/pastore_app/lib/main.dart:241:17
  I/flutter ( 7901): When the exception was thrown, this was the stack:
  I/flutter ( 7901): #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
  I/flutter ( 7901): #1      SliverChildListDelegate.build (package:flutter/src/widgets/sliver.dart:672:27)
  I/flutter ( 7901): #2      SliverMultiBoxAdaptorElement._build.&lt;anonymous closure&gt; (package:flutter/src/widgets/sliver.dart:1153:67)
  I/flutter ( 7901): #3      _HashMap.putIfAbsent (dart:collection-patch/collection_patch.dart:137:29)
  I/flutter ( 7901): #4      SliverMultiBoxAdaptorElement._build (package:flutter/src/widgets/sliver.dart:1153:26)
  I/flutter ( 7901): #5      SliverMultiBoxAdaptorElement.createChild.&lt;anonymous closure&gt; (package:flutter/src/widgets/sliver.dart:1166:55)
  I/flutter ( 7901): #6      BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2328:19)
  I/flutter ( 7901): #7      SliverMultiBoxAdaptorElement.createChild (package:flutter/src/widgets/sliver.dart:1159:11)
  I/flutter ( 7901): #8      RenderSliverMultiBoxAdaptor._createOrObtainChild.&lt;anonymous closure&gt; (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:354:23)
  I/flutter ( 7901): #9      RenderObject.invokeLayoutCallback.&lt;anonymous closure&gt; (package:flutter/src/rendering/object.dart:1797:58)
  I/flutter ( 7901): #10     PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:875:15)
  I/flutter ( 7901): #11     RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:1797:13)
  I/flutter ( 7901): #12     RenderSliverMultiBoxAdaptor._createOrObtainChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:343:5)
  I/flutter ( 7901): #13     RenderSliverMultiBoxAdaptor.addInitialChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:427:5)
  I/flutter ( 7901): #14     RenderSliverFixedExtentBoxAdaptor.performLayout (package:flutter/src/rendering/sliver_fixed_extent_list.dart:196:12)
  I/flutter ( 7901): #15     RenderObject.layout (package:flutter/src/rendering/object.dart:1701:7)
  I/flutter ( 7901): #16     RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:406:13)
  I/flutter ( 7901): #17     RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1352:12)
  I/flutter ( 7901): #18     RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1270:20)
  I/flutter ( 7901): #19     RenderObject.layout (package:flutter/src/rendering/object.dart:1701:7)
  I/flutter ( 7901): #20     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
  I/flutter ( 7901): #21     RenderObject.layout (package:flutter/src/rendering/object.dart:1701:7)
  I/flutter ( 7901): #22     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
  I/flutter ( 7901): #23     RenderObject.layout (package:flutter/src/rendering/object.dart:1701:7)
  I/flutter ( 7901): #24     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
  I/flutter ( 7901): #25     RenderObject.layout (package:flutter/src/rendering/object.dart:1701:7)
  I/flutter ( 7901): #26     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
  I/flutter ( 7901): #27     RenderObject.layout (package:flutter/src/rendering/object.dart:1701:7)
  I/flutter ( 7901): #28     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
  I/flutter ( 7901): #29     RenderObject.layout (package:flutter/src/rendering/object.dart:1701:7)
  I/flutter ( 7901): #30     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
  I/flutter ( 7901): #31     RenderObject.layout (package:flutter/src/rendering/object.dart:1701:7)
  I/flutter ( 7901): #32     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
  I/flutter ( 7901): #33     RenderObject.layout (package:flutter/src/rendering/object.dart:1701:7)
  I/flutter ( 7901): #34     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
  I/flutter ( 7901): #35     RenderObject.layout (package:flutter/src/rendering/object.dart:1701:7)
  I/flutter ( 7901): #36     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
  I/flutter ( 7901): #37     RenderObject.layout (package:flutter/src/rendering/object.dart:1701:7)
  I/flutter ( 7901): #38     MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:142:11)
  I/flutter ( 7901): #39     _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:444:7)
  I/flutter ( 7901): #40     MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:212:7)
  I/flutter ( 7901): #41     RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:356:14)
  I/flutter ( 7901): #42     RenderObject.layout (package:flutter/src/rendering/object.dart:1701:7)
  I/flutter ( 7901): #43     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
  I/flutter ( 7901): #44     RenderObject.layout (package:flutter/src/rendering/object.dart:1701:7)
  I/flutter ( 7901): #45     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
  I/flutter ( 7901): #46     _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1232:11)
  I/flutter ( 7901): #47     RenderObject.layout (package:flutter/src/rendering/object.dart:1701:7)
  I/flutter ( 7901): #48     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
  I/flutter ( 7901): #49     RenderObject.layout (package:flutter/src/rendering/object.dart:1701:7)
  I/flutter ( 7901): #50     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
  I/flutter ( 7901): #51     RenderObject.layout (package:flutter/src/rendering/object.dart:1701:7)
  I/flutter ( 7901): #52     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
  I/flutter ( 7901): #53     RenderObject.layout (package:flutter/src/rendering/object.dart:1701:7)
  I/flutter ( 7901): #54     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
  I/flutter ( 7901): #55     RenderObject.layout (package:flutter/src/rendering/object.dart:1701:7)
  I/flutter ( 7901): #56     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
  I/flutter ( 7901): #57     RenderObject.layout (package:flutter/src/rendering/object.dart:1701:7)
  I/flutter ( 7901): #58     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
  I/flutter ( 7901): #59     RenderObject.layout (package:flutter/src/rendering/object.dart:1701:7)
  I/flutter ( 7901): #60     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
  I/flutter ( 7901): #61     RenderObject.layout (package:flutter/src/rendering/object.dart:1701:7)
  I/flutter ( 7901): #62     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
  I/flutter ( 7901): #63     RenderOffstage.performLayout (package:flutter/src/rendering/proxy_box.dart:3140:13)
  I/flutter ( 7901): #64     RenderObject.layout (package:flutter/src/rendering/object.dart:1701:7)
  I/flutter ( 7901): #65     RenderStack.performLayout (package:flutter/src/rendering/stack.dart:510:15)
  I/flutter ( 7901): #66     RenderObject.layout (package:flutter/src/rendering/object.dart:1701:7)
  I/flutter ( 7901): #67     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
  I/flutter ( 7901): #68     RenderObject.layout (package:flutter/src/rendering/object.dart:1701:7)
  I/flutter ( 7901): #69     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
  I/flutter ( 7901): #70     RenderObject.layout (package:flutter/src/rendering/object.dart:1701:7)
  I/flutter ( 7901): #71     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
  I/flutter ( 7901): #72     RenderObject.layout (package:flutter/src/rendering/object.dart:1701:7)
  I/flutter ( 7901): #73     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
  I/flutter ( 7901): #74     RenderObject.layout (package:flutter/src/rendering/object.dart:1701:7)
  I/flutter ( 7901): #75     RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
  I/flutter ( 7901): #76     RenderObject.layout (package:flutter/src/rendering/object.dart:1701:7)
  I/flutter ( 7901): #77     RenderView.performLayout (package:flutter/src/rendering/view.dart:152:13)
  I/flutter ( 7901): #78     RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1578:7)
  I/flutter ( 7901): #79     PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:844:18)
  I/flutter ( 7901): #80     RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:341:19)
  I/flutter ( 7901): #81     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:761:13)
  I/flutter ( 7901): #82     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:280:5)
  I/flutter ( 7901): #83     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1033:15)
  I/flutter ( 7901): #84     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:975:9)
  I/flutter ( 7901): #85     SchedulerBinding.scheduleWarmUpFrame.&lt;anonymous closure&gt; (package:flutter/src/scheduler/binding.dart:784:7)
  I/flutter ( 7901): #94     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:382:19)
  I/flutter ( 7901): #95     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:416:5)
  I/flutter ( 7901): #96     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)
  I/flutter ( 7901): (elided 8 frames from package dart:async and package dart:async-patch)
  I/flutter ( 7901): The following RenderObject was being processed when the exception was fired: RenderSliverFillViewport#d6420 relayoutBoundary=up1 NEEDS-LAYOUT NEEDS-PAINT:
  I/flutter ( 7901):   creator: SliverFillViewport ← Viewport ← IgnorePointer-[GlobalKey#cec9a] ← Semantics ←
  I/flutter ( 7901):     _PointerListener ← Listener ← _GestureSemantics ←
  I/flutter ( 7901):     RawGestureDetector-[LabeledGlobalKey&lt;RawGestureDetectorState&gt;#9d04a] ← _PointerListener ← Listener
  I/flutter ( 7901):     ← _ScrollableScope ← _ScrollSemantics-[GlobalKey#04774] ← ⋯
  I/flutter ( 7901):   parentData: paintOffset=Offset(0.0, 0.0) (can use size)
  I/flutter ( 7901):   constraints: SliverConstraints(AxisDirection.right, GrowthDirection.forward, ScrollDirection.idle,
  I/flutter ( 7901):     scrollOffset: 0.0, remainingPaintExtent: 600.9, crossAxisExtent: 802.7, crossAxisDirection:
  I/flutter ( 7901):     AxisDirection.down, viewportMainAxisExtent: 600.9, remainingCacheExtent: 600.9 cacheOrigin: 0.0 )
  I/flutter ( 7901):   geometry: null
  I/flutter ( 7901):   no children current live
  I/flutter ( 7901): This RenderObject has no descendants.
  I/flutter ( 7901): ════════════════════════════════════════════════════════════════════════════════════════════════════
  I/flutter ( 7901): Another exception was thrown: NoSuchMethodError: The method 'debugAssertIsValid' was called on null.
  I/flutter ( 7901): Another exception was thrown: NoSuchMethodError: The getter 'visible' was called on null.
  </code></pre>
  
  <p>I have tried to add a GlobalKey to the PageView key value but it didn't work.</p>
  
  <p>Maybe the problem is in the _onEntryChanged function but i commented it and the problem still remaining.
  Here the code snippet:</p>
  
  <pre><code> _onEntryChanged(Event event) {
      var oldEntry = carList.singleWhere((entry) {
        return entry.key == event.snapshot.key;
      });
      setState(() {
        carList[carList.indexOf(oldEntry)] = Car.fromSnapshot(event.snapshot);
      });
    }
  </code></pre>
  
  <p>Here is the link of the github repo with all the file. <a href="https://github.com/hobbit-xD/pastore_app/tree/master/lib" rel="nofollow noreferrer">GitHub Repository</a></p>
  
  <p>Thank you very much if you can help me.</p>