<p dir="auto">Switching between the different app bar display options in the "Contact profile" study can cause the Flutter Gallery app to crash. I tested this on a OnePlus3T using the production version on the PlayStore and locally using the version in v0.5.1.</p>
<p dir="auto"><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/HansMuller/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/HansMuller">@HansMuller</a> I think this is behind the error in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="323074231" data-permission-text="Title is private" data-url="https://github.com/flutter/flutter/issues/17598" data-hovercard-type="issue" data-hovercard-url="/flutter/flutter/issues/17598/hovercard" href="https://github.com/flutter/flutter/issues/17598">#17598</a></p>
<h2 dir="auto">Steps to Reproduce</h2>
<ol dir="auto">
<li>
<p dir="auto">Open the "Contact profile" study</p>
</li>
<li>
<p dir="auto">Scroll the bottom of the page</p>
</li>
<li>
<p dir="auto">Select the drop down menu in top right of the app bar and choose the "App bar snaps" option</p>
</li>
<li>
<p dir="auto">Scroll up until the full app bar is displayed (screenshot attached)<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/6425402/42969772-25235964-8b5c-11e8-853f-4b01addf6a3e.png"><img src="https://user-images.githubusercontent.com/6425402/42969772-25235964-8b5c-11e8-853f-4b01addf6a3e.png" alt="1" style="max-width: 100%;"></a></p>
</li>
<li>
<p dir="auto">Select the "App bar floats" option</p>
</li>
</ol>
<p dir="auto">The app will not immediately crash but it is in a bad state and further actions will cause various exceptions and crashes. Logs attached below.</p>
<h2 dir="auto">Logs</h2>
<h3 dir="auto">Error when scrolling:</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[+34049 ms] I/flutter (29797): ══╡ EXCEPTION CAUGHT BY FOUNDATION LIBRARY ╞════════════════════════════════════════════════════════
[  +19 ms] I/flutter (29797): The following NoSuchMethodError was thrown while dispatching notifications for ValueNotifier&lt;bool&gt;:
[        ] I/flutter (29797): The method 'stop' was called on null.
[        ] I/flutter (29797): Receiver: null
[   +1 ms] I/flutter (29797): Tried calling: stop(canceled: true)
[        ] I/flutter (29797):
[        ] I/flutter (29797): When the exception was thrown, this was the stack:
[  +12 ms] I/flutter (29797): #0      Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:46:5)
[        ] I/flutter (29797): #1      AnimationController.stop (package:flutter/src/animation/animation_controller.dart:499:13)
[        ] I/flutter (29797): #2      RenderSliverFloatingPersistentHeader.maybeStopSnapAnimation (package:flutter/src/rendering/sliver_persistent_header.dart:457:18)
[        ] I/flutter (29797): #3      _FloatingAppBarState._isScrollingListener (package:flutter/src/material/app_bar.dart:547:15)
[        ] I/flutter (29797): #4      ChangeNotifier.notifyListeners (package:flutter/src/foundation/change_notifier.dart:161:21)
[        ] I/flutter (29797): #5      ValueNotifier.value= (package:flutter/src/foundation/change_notifier.dart:217:5)
[        ] I/flutter (29797): #6      ScrollPosition.beginActivity (package:flutter/src/widgets/scroll_position.dart:613:25)
[        ] I/flutter (29797): #7      ScrollPositionWithSingleContext.beginActivity (package:flutter/src/widgets/scroll_position_with_single_context.dart:117:11)
[        ] I/flutter (29797): #8      ScrollPositionWithSingleContext.drag (package:flutter/src/widgets/scroll_position_with_single_context.dart:245:5)
[        ] I/flutter (29797): #9      ScrollableState._handleDragStart (package:flutter/src/widgets/scrollable.dart:443:22)
[   +1 ms] I/flutter (29797): #10     DragGestureRecognizer.acceptGesture.&lt;anonymous closure&gt; (package:flutter/src/gestures/monodrag.dart:169:47)
[        ] I/flutter (29797): #11     GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24)
[        ] I/flutter (29797): #12     DragGestureRecognizer.acceptGesture (package:flutter/src/gestures/monodrag.dart:169:9)
[        ] I/flutter (29797): #13     GestureArenaManager._resolveByDefault (package:flutter/src/gestures/arena.dart:250:25)
[        ] I/flutter (29797): #14     GestureArenaManager._tryToResolveArena.&lt;anonymous closure&gt; (package:flutter/src/gestures/arena.dart:231:31)
[        ] I/flutter (29797): (elided 2 frames from package dart:async)
[        ] I/flutter (29797):
[        ] I/flutter (29797): The ValueNotifier&lt;bool&gt; sending notification was:
[        ] I/flutter (29797):   ValueNotifier&lt;bool&gt;#0a1d4(true)
[        ] I/flutter (29797): ════════════════════════════════════════════════════════════════════════════════════════════════════"><pre class="notranslate"><code class="notranslate">[+34049 ms] I/flutter (29797): ══╡ EXCEPTION CAUGHT BY FOUNDATION LIBRARY ╞════════════════════════════════════════════════════════
[  +19 ms] I/flutter (29797): The following NoSuchMethodError was thrown while dispatching notifications for ValueNotifier&lt;bool&gt;:
[        ] I/flutter (29797): The method 'stop' was called on null.
[        ] I/flutter (29797): Receiver: null
[   +1 ms] I/flutter (29797): Tried calling: stop(canceled: true)
[        ] I/flutter (29797):
[        ] I/flutter (29797): When the exception was thrown, this was the stack:
[  +12 ms] I/flutter (29797): #0      Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:46:5)
[        ] I/flutter (29797): #1      AnimationController.stop (package:flutter/src/animation/animation_controller.dart:499:13)
[        ] I/flutter (29797): #2      RenderSliverFloatingPersistentHeader.maybeStopSnapAnimation (package:flutter/src/rendering/sliver_persistent_header.dart:457:18)
[        ] I/flutter (29797): #3      _FloatingAppBarState._isScrollingListener (package:flutter/src/material/app_bar.dart:547:15)
[        ] I/flutter (29797): #4      ChangeNotifier.notifyListeners (package:flutter/src/foundation/change_notifier.dart:161:21)
[        ] I/flutter (29797): #5      ValueNotifier.value= (package:flutter/src/foundation/change_notifier.dart:217:5)
[        ] I/flutter (29797): #6      ScrollPosition.beginActivity (package:flutter/src/widgets/scroll_position.dart:613:25)
[        ] I/flutter (29797): #7      ScrollPositionWithSingleContext.beginActivity (package:flutter/src/widgets/scroll_position_with_single_context.dart:117:11)
[        ] I/flutter (29797): #8      ScrollPositionWithSingleContext.drag (package:flutter/src/widgets/scroll_position_with_single_context.dart:245:5)
[        ] I/flutter (29797): #9      ScrollableState._handleDragStart (package:flutter/src/widgets/scrollable.dart:443:22)
[   +1 ms] I/flutter (29797): #10     DragGestureRecognizer.acceptGesture.&lt;anonymous closure&gt; (package:flutter/src/gestures/monodrag.dart:169:47)
[        ] I/flutter (29797): #11     GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24)
[        ] I/flutter (29797): #12     DragGestureRecognizer.acceptGesture (package:flutter/src/gestures/monodrag.dart:169:9)
[        ] I/flutter (29797): #13     GestureArenaManager._resolveByDefault (package:flutter/src/gestures/arena.dart:250:25)
[        ] I/flutter (29797): #14     GestureArenaManager._tryToResolveArena.&lt;anonymous closure&gt; (package:flutter/src/gestures/arena.dart:231:31)
[        ] I/flutter (29797): (elided 2 frames from package dart:async)
[        ] I/flutter (29797):
[        ] I/flutter (29797): The ValueNotifier&lt;bool&gt; sending notification was:
[        ] I/flutter (29797):   ValueNotifier&lt;bool&gt;#0a1d4(true)
[        ] I/flutter (29797): ════════════════════════════════════════════════════════════════════════════════════════════════════
</code></pre></div>
<h3 dir="auto">Error when trying to switch to the 'App bar snaps' option:</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[+40490 ms] I/flutter (29797): Another exception was thrown: AnimationController.dispose() called more than once.
[   +8 ms] I/flutter (29797): Another exception was thrown: A RenderViewport expected a child of type RenderSliver but received a child of type RenderErrorBox.
[   +9 ms] I/chatty  (29797): uid=10084(io.flutter.demo.gallery) 1.ui identical 1 line
[        ] I/flutter (29797): Another exception was thrown: A RenderViewport expected a child of type RenderSliver but received a child of type RenderErrorBox.
[        ] I/flutter (29797): Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 3497 pos 14: 'owner._debugCurrentBuildTarget == this': is not true.
[+2095 ms] I/chatty  (29797): uid=10084(io.flutter.demo.gallery) 1.ui identical 20 lines
[        ] I/flutter (29797): Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 3497 pos 14: 'owner._debugCurrentBuildTarget == this': is not true."><pre class="notranslate"><code class="notranslate">[+40490 ms] I/flutter (29797): Another exception was thrown: AnimationController.dispose() called more than once.
[   +8 ms] I/flutter (29797): Another exception was thrown: A RenderViewport expected a child of type RenderSliver but received a child of type RenderErrorBox.
[   +9 ms] I/chatty  (29797): uid=10084(io.flutter.demo.gallery) 1.ui identical 1 line
[        ] I/flutter (29797): Another exception was thrown: A RenderViewport expected a child of type RenderSliver but received a child of type RenderErrorBox.
[        ] I/flutter (29797): Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 3497 pos 14: 'owner._debugCurrentBuildTarget == this': is not true.
[+2095 ms] I/chatty  (29797): uid=10084(io.flutter.demo.gallery) 1.ui identical 20 lines
[        ] I/flutter (29797): Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 3497 pos 14: 'owner._debugCurrentBuildTarget == this': is not true.
</code></pre></div>
<h3 dir="auto">Error when clicking the back button</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[+242379 ms] I/flutter (29797): Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 4062 pos 14: '() {
[ +279 ms] I/flutter (29797): Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 2240 pos 16: '!_dirtyElements[index]._active || _dirtyElements[index]._debugIsInScope(context)': is not true."><pre class="notranslate"><code class="notranslate">[+242379 ms] I/flutter (29797): Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 4062 pos 14: '() {
[ +279 ms] I/flutter (29797): Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 2240 pos 16: '!_dirtyElements[index]._active || _dirtyElements[index]._debugIsInScope(context)': is not true.
</code></pre></div>
<h3 dir="auto">Error when trying to re-open the Contact profile study after the last crash</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[+457845 ms] I/flutter (29797): Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 3681 pos 12: 'child == _child': is not true.
[   +6 ms] I/flutter (29797): Another exception was thrown: Duplicate GlobalKey detected in widget tree."><pre class="notranslate"><code class="notranslate">[+457845 ms] I/flutter (29797): Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 3681 pos 12: 'child == _child': is not true.
[   +6 ms] I/flutter (29797): Another exception was thrown: Duplicate GlobalKey detected in widget tree.
</code></pre></div>
<p dir="auto">Flutter doctor is amazing! But, for the first hour, it may be (incorrectly) suggesting that you need <em>both</em> iOS and Android toolchains installed <em>just to try Flutter</em>.</p>
<p dir="auto">See anecdote here: <a href="https://twitter.com/clarklab/status/998613583599669250" rel="nofollow">https://twitter.com/clarklab/status/998613583599669250</a></p>