Flutter issue log

Documenting  small problems encountered while struggling with Flutter

1  Navigator  Routes  GestureDetector

Question 1:

  1. I/flutter (19058): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
  2. I/flutter (19058): The following assertion was thrown building Setting(dirty, state: _SettingState#e1f3d):
  3. I/flutter (19058): setState() or markNeedsBuild() called during build.
  4. I/flutter (19058): This Overlay widget cannot be marked as needing to build because the framework is already in the
  5. I/flutter (19058): process of building widgets. A widget can be marked as needing to be built during the build phase
  6. I/flutter (19058): only if one of its ancestors is currently building. This exception is allowed because the framework
  7. I/flutter (19058): builds parent widgets before children, which means a dirty descendant will always be built.
  8. I/flutter (19058): Otherwise, the framework might not visit this widget during this build phase.
  9. I/flutter (19058): The widget on which setState() or markNeedsBuild() was called was:
  10. I/flutter (19058): Overlay-[LabeledGlobalKey<OverlayState>#bc2d4]
  11. I/flutter (19058): The widget which was currently being built when the offending call was made was:
  12. I/flutter (19058): Setting
  13. I/flutter (19058):
  14. I/flutter (19058): When the exception was thrown, this was the stack:
  15. I/flutter (19058): #0 Element.markNeedsBuild.<anonymous closure> (package:flutter/src/widgets/framework.dart:3670:11)
  16. I/flutter (19058): #1 Element.markNeedsBuild (package:flutter/src/widgets/framework.dart:3685:6)
  17. I/flutter (19058): #2 State.setState (package:flutter/src/widgets/framework.dart:1161:14)
  18. I/flutter (19058): #3 OverlayState.insertAll (package:flutter/src/widgets/overlay.dart:346:5)
  19. I/flutter (19058): #4 OverlayRoute.install (package:flutter/src/widgets/routes.dart:43:24)
  20. I/flutter (19058): #5 TransitionRoute.install (package:flutter/src/widgets/routes.dart:180:11)
  21. I/flutter (19058): #6 ModalRoute.install (package:flutter/src/widgets/routes.dart:907:11)
  22. I/flutter (19058): #7 NavigatorState.push (package:flutter/src/widgets/navigator.dart:1754:11)
  23. I/flutter (19058): #8 NavigatorState.pushNamed (package:flutter/src/widgets/navigator.dart:1649:12)
  24. I/flutter (19058): #9 Navigator.pushNamed (package:flutter/src/widgets/navigator.dart:889:34)
  25. I/flutter (19058): #10 onClick (package:scc_etkq_app_flutter/routes/settingmodule/setting.dart:268:13)
  26. I/flutter (19058): #11 _SettingState.build (package:scc_etkq_app_flutter/routes/settingmodule/setting.dart:251:26)
  27. I/flutter (19058): #12 StatefulElement.build (package:flutter/src/widgets/framework.dart:4012:27)
  28. I/flutter (19058): #13 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3924:15)
  29. I/flutter (19058): #14 Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
  30. I/flutter (19058): #15 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3907:5)
  31. I/flutter (19058): #16 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4053:11)
  32. I/flutter (19058): #17 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3902:5)
  33. I/flutter (19058): #18 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
  34. I/flutter (19058): #19 Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
  35. I/flutter (19058): #20 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5092:14)
  36. I/flutter (19058): #21 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
  37. I/flutter (19058): #22 Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
  38. I/flutter (19058): #23 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
  39. I/flutter (19058): #24 Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
  40. I/flutter (19058): #25 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3907:5)
  41. I/flutter (19058): #26 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3902:5)
  42. I/flutter (19058): #27 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
  43. I/flutter (19058): #28 Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
  44. I/flutter (19058): #29 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5092:14)
  45. I/flutter (19058): #30 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
  46. I/flutter (19058): #31 Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
  47. I/flutter (19058): #32 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5092:14)
  48. I/flutter (19058): #33 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
  49. I/flutter (19058): #34 Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
  50. I/flutter (19058): #35 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5092:14)
  51. I/flutter (19058): #36 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
  52. I/flutter (19058): #37 Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
  53. I/flutter (19058): #38 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5092:14)
  54. I/flutter (19058): #39 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
  55. I/flutter (19058): #40 Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
  56. I/flutter (19058): #41 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
  57. I/flutter (19058): #42 Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
  58. I/flutter (19058): #43 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3907:5)
  59. I/flutter (19058): #44 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4053:11)
  60. I/flutter (19058): #45 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3902:5)
  61. I/flutter (19058): #46 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
  62. I/flutter (19058): #47 Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
  63. I/flutter (19058): #48 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
  64. I/flutter (19058): #49 Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
  65. I/flutter (19058): #50 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3907:5)
  66. I/flutter (19058): #51 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3902:5)
  67. I/flutter (19058): #52 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
  68. I/flutter (19058): #53 Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
  69. I/flutter (19058): #54 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
  70. I/flutter (19058): #55 Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
  71. I/flutter (19058): #56 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3907:5)
  72. I/flutter (19058): #57 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4053:11)
  73. I/flutter (19058): #58 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3902:5)
  74. I/flutter (19058): #59 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
  75. I/flutter (19058): #60 Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
  76. I/flutter (19058): #61 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5092:14)
  77. I/flutter (19058): #62 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
  78. I/flutter (19058): #63 Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
  79. I/flutter (19058): #64 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
  80. I/flutter (19058): #65 Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
  81. I/flutter (19058): #66 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3907:5)
  82. I/flutter (19058): #67 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3902:5)
  83. I/flutter (19058): #68 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
  84. I/flutter (19058): #69 Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
  85. I/flutter (19058): #70 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5092:14)
  86. I/flutter (19058): #71 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
  87. I/flutter (19058): #72 Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
  88. I/flutter (19058): #73 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
  89. I/flutter (19058): #74 Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
  90. I/flutter (19058): #75 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3907:5)
  91. I/flutter (19058): #76 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4053:11)
  92. I/flutter (19058): #77 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3902:5)
  93. I/flutter (19058): #78 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
  94. I/flutter (19058): #79 Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
  95. I/flutter (19058): #80 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
  96. I/flutter (19058): #81 Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
  97. I/flutter (19058): #82 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3907:5)
  98. I/flutter (19058): #83 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3902:5)
  99. I/flutter (19058): #84 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
  100. I/flutter (19058): #85 Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
  101. I/flutter (19058): #86 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5092:14)
  102. I/flutter (19058): #87 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
  103. I/flutter (19058): #88 Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
  104. I/flutter (19058): #89 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
  105. I/flutter (19058): #90 Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
  106. I/flutter (19058): #91 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3907:5)
  107. I/flutter (19058): #92 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3902:5)
  108. I/flutter (19058): #93 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
  109. I/flutter (19058): #94 Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
  110. I/flutter (19058): #95 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
  111. I/flutter (19058): #96 Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
  112. I/flutter (19058): #97 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3907:5)
  113. I/flutter (19058): #98 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4053:11)
  114. I/flutter (19058): #99 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3902:5)
  115. I/flutter (19058): #100 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
  116. I/flutter (19058): #101 Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
  117. I/flutter (19058): #102 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
  118. I/flutter (19058): #103 Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
  119. I/flutter (19058): #104 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:3907:5)
  120. I/flutter (19058): #105 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4053:11)
  121. I/flutter (19058): #106 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3902:5)
  122. I/flutter (19058): #107 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3084:14)
  123. I/flutter (19058): #108 Element.updateChild (package:flutter/src/widgets/framework.dart:2887:12)
  124. I/flutter (19058): #109 RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:4875:32)
  125. I/flutter (19058): #110 MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5208:17)
  126. I/flutter (19058): #111 Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
  127. I/flutter (19058): #112 _TheatreElement.update (package:flutter/src/widgets/overlay.dart:607:16)
  128. I/flutter (19058): #113 Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
  129. I/flutter (19058): #114 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
  130. I/flutter (19058): #115 Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
  131. I/flutter (19058): #116 StatefulElement.update (package:flutter/src/widgets/framework.dart:4085:5)
  132. I/flutter (19058): #117 Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
  133. I/flutter (19058): #118 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
  134. I/flutter (19058): #119 Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
  135. I/flutter (19058): #120 ProxyElement.update (package:flutter/src/widgets/framework.dart:4219:5)
  136. I/flutter (19058): #121 _InheritedNotifierElement.update (package:flutter/src/widgets/inherited_notifier.dart:94:11)
  137. I/flutter (19058): #122 Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
  138. I/flutter (19058): #123 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5099:14)
  139. I/flutter (19058): #124 Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
  140. I/flutter (19058): #125 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
  141. I/flutter (19058): #126 Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
  142. I/flutter (19058): #127 StatefulElement.update (package:flutter/src/widgets/framework.dart:4085:5)
  143. I/flutter (19058): #128 Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
  144. I/flutter (19058): #129 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5099:14)
  145. I/flutter (19058): #130 Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
  146. I/flutter (19058): #131 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5099:14)
  147. I/flutter (19058): #132 Element.updateChild (package:flutter/src/widgets/framework.dart:2876:15)
  148. I/flutter (19058): #133 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3935:16)
  149. I/flutter (19058): #134 Element.rebuild (package:flutter/src/widgets/framework.dart:3721:5)
  150. I/flutter (19058): #135 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2340:33)
  151. I/flutter (19058): #136 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:700:20)
  152. I/flutter (19058): #137 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:285:5)
  153. I/flutter (19058): #138 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1016:15)
  154. I/flutter (19058): #139 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:958:9)
  155. I/flutter (19058): #140 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:874:5)
  156. I/flutter (19058): #144 _invoke (dart:ui/hooks.dart:236:10)
  157. I/flutter (19058): #145 _drawFrame (dart:ui/hooks.dart:194:3)
  158. I/flutter (19058): (elided 3 frames from package dart:async)
  159. I/flutter (19058): ════════════════════════════════════════════════════════════════════════════════════════════════════

Question 1 Location

Solution:

  1. class MyApp extends StatelessWidget {
  2. @override
  3. Widget build(BuildContext context) {
  4. final wordPair = new WordPair.random();
  5. // TODO: implement build
  6. return new MaterialApp(
  7. title: "Otoke Banner" ,
  8. theme: new ThemeData(primarySwatch: Colors.blue),
  9. home: new MyHomePage (title: 'Etuoke Banner Safety Production Informatization'),
  10. routes:<String, WidgetBuilder>{
  11. "/routes/settingmodule/setting":(BuildContext context)=> Setting(),
  12. "/routes/settingmodule/login":(BuildContext context)=> Login()
  13. },
  14. );
  15. }
  16. }
  17. new Container (
  18. child: Align(
  19. alignment: Alignment.center,
  20. child: new GestureDetector(
  21. onTap: () {
  22. _onClick(context);
  23. },
  24. child: new Text(
  25. "Sign out" ,
  26. style:
  27. new TextStyle(color: Color(0xFF9EA7B4), fontSize: 15),
  28. ),
  29. )),
  30. )
  31. void _onClick(BuildContext context) {
  32. // Navigator.pop(context);
  33. Navigator.pushNamed(context, "/routes/settingmodule/login");
  34. }

 

Related: Flutter issue log