Issue 1:
Steps to Reproduce

exec: flutter run

change widget code

hot-reload，the application works correctly

leave behind for a while

active the application, touch the button to back to login page.

the application crash and the terminal show logs as below:

Logs

flutter: ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
flutter: The following assertion was thrown building TickerMode(mode: disabled):
flutter: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 1744 pos 12:
flutter: '_elements.contains(element)': is not true.
flutter:
flutter: Either the assertion indicates an error in the framework itself, or we should provide substantially
flutter: more information in this error message to help you determine and fix theunderlying cause.
flutter: In either case, please report this assertion by filing a bug on GitHub:
flutter: https://github.com/flutter/flutter/issues/new?template=BUG.md
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #2 _InactiveElements.remove (package:flutter/src/widgets/framework.dart:1744:12)
flutter: #3 Element._retakeInactiveElement (package:flutter/src/widgets/framework.dart:2915:29)
flutter: #4 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2938:32)
flutter: #5 Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
flutter: #6 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #7 Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #8 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3701:5)
flutter: #9 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3696:5)
flutter: #10 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
flutter: #11 _TheatreElement.mount (package:flutter/src/widgets/overlay.dart:497:32)
flutter: #12 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2950:14)
flutter: #13 Element.updateChild (package:flutter/src/widgets/framework.dart:2753:12)
flutter: #14 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #15 Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #16 StatefulElement.update (package:flutter/src/widgets/framework.dart:3878:5)
flutter: #17 Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #18 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #19 Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #20 ProxyElement.update (package:flutter/src/widgets/framework.dart:3990:5)
flutter: #21 Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #22 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4867:14)
flutter: #23 Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #24 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #25 Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #26 StatefulElement.update (package:flutter/src/widgets/framework.dart:3878:5)
flutter: #27 Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #28 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4867:14)
flutter: #29 Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #30 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4867:14)
flutter: #31 Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #32 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #33 Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #34 StatefulElement.update (package:flutter/src/widgets/framework.dart:3878:5)
flutter: #35 Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #36 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #37 Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #38 ProxyElement.update (package:flutter/src/widgets/framework.dart:3990:5)
flutter: #39 Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #40 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4867:14)
flutter: #41 Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #42 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #43 Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #44 StatelessElement.update (package:flutter/src/widgets/framework.dart:3781:5)
flutter: #45 Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #46 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #47 Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #48 StatelessElement.update (package:flutter/src/widgets/framework.dart:3781:5)
flutter: #49 Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #50 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #51 Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #52 StatelessElement.update (package:flutter/src/widgets/framework.dart:3781:5)
flutter: #53 Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #54 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #55 Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #56 ProxyElement.update (package:flutter/src/widgets/framework.dart:3990:5)
flutter: #57 Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #58 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #59 Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #60 ProxyElement.update (package:flutter/src/widgets/framework.dart:3990:5)
flutter: #61 Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #62 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4867:14)
flutter: #63 Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #64 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #65 Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #66 StatefulElement.update (package:flutter/src/widgets/framework.dart:3878:5)
flutter: #67 Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #68 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #69 Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #70 ProxyElement.update (package:flutter/src/widgets/framework.dart:3990:5)
flutter: #71 Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #72 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #73 Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #74 StatefulElement.update (package:flutter/src/widgets/framework.dart:3878:5)
flutter: #75 Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #76 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #77 Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #78 ProxyElement.update (package:flutter/src/widgets/framework.dart:3990:5)
flutter: #79 Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #80 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #81 Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #82 ProxyElement.update (package:flutter/src/widgets/framework.dart:3990:5)
flutter: #83 Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #84 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #85 Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #86 StatelessElement.update (package:flutter/src/widgets/framework.dart:3781:5)
flutter: #87 Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #88 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #89 Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #90 StatefulElement.update (package:flutter/src/widgets/framework.dart:3878:5)
flutter: #91 Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #92 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #93 Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #94 ProxyElement.update (package:flutter/src/widgets/framework.dart:3990:5)
flutter: #95 Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #96 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #97 Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #98 StatefulElement.update (package:flutter/src/widgets/framework.dart:3878:5)
flutter: #99 Element.updateChild (package:flutter/src/widgets/framework.dart:2742:15)
flutter: #100 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3732:16)
flutter: #101 Element.rebuild (package:flutter/src/widgets/framework.dart:3547:5)
flutter: #102 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2286:33)
flutter: #103 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:676:20)
flutter: #104 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:219:5)
flutter: #105 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:990:15)
flutter: #106 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:930:9)
flutter: #107 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:751:7)
flutter: #109 _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)
flutter: #110 _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)
flutter: #111 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
flutter: (elided 3 frames from class _AssertionError and package dart:async)
flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════
flutter: Another exception was thrown: Duplicate GlobalKeys detected in widget tree.

Reloaded 0 of 438 libraries in 2,527ms.
flutter: Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 1744 pos 12: '_elements.contains(element)': is not true.
flutter: Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 4954 pos 12: '_children.contains(child)': is not true.
flutter: Another exception was thrown: Duplicate GlobalKey detected in widget tree.

Analyzing material-components-flutter-Codelabs...
No issues found! (ran in 2.3s)

Flutter (Channel unknown, v1.1.0, on Mac OS X 10.13.6 17G65, locale
zh-Hans-CN)
• Flutter version 1.1.0 at /Users/jiangxiaokun/projects/flutter
• Framework revision 3cca1a2ec3 (4 days ago), 2018-12-11 18:50:51 +0000
• Engine revision 7375a0f414
• Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

Issue 2:
Issue

When you run hot reload and then start the application again, the changes are reverted.

I think that the behaviour could be misleading if you come from Instant Run or JRebel for Android... I know this is the actual intended behaviour, but I'm afraid is not clear to all the potential users.

Steps to Reproduce

Please check this video on steps to reproduce