运行 flutter 官网的demo 报错
来源:7-2 学习构建Flutter实例项目【他山之石可以攻玉】
LeeDev106
2020-01-15
Launching lib/main.dart on Redmi Note 4X in debug mode…
Running Gradle task ‘assembleDebug’…
I/flutter ( 9862): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter ( 9862): The following assertion was thrown building PhotoApp(dirty, dependencies:
I/flutter ( 9862): [_LocalizationsScope-[GlobalKey#ca719], _InheritedTheme], state: _PhotoAppState#36fc2):
I/flutter ( 9862): setState() or markNeedsBuild() called during build.
I/flutter ( 9862): This Overlay widget cannot be marked as needing to build because the framework is already in the
I/flutter ( 9862): process of building widgets. A widget can be marked as needing to be built during the build phase
I/flutter ( 9862): only if one of its ancestors is currently building. This exception is allowed because the framework
I/flutter ( 9862): builds parent widgets before children, which means a dirty descendant will always be built.
I/flutter ( 9862): Otherwise, the framework might not visit this widget during this build phase.
I/flutter ( 9862): The widget on which setState() or markNeedsBuild() was called was:
I/flutter ( 9862): Overlay-[LabeledGlobalKey#0b117]
I/flutter ( 9862): The widget which was currently being built when the offending call was made was:
I/flutter ( 9862): PhotoApp
I/flutter ( 9862):
I/flutter ( 9862): The relevant error-causing widget was:
I/flutter ( 9862): PhotoApp file:///Users/leedev/Desktop/Work/flutter_test/flutter_app_1/lib/main.dart:156:31
I/flutter ( 9862):
I/flutter ( 9862): When the exception was thrown, this was the stack:
I/flutter ( 9862): #0 Element.markNeedsBuild. (package:flutter/src/widgets/framework.dart:3896:11)
I/flutter ( 9862): #1 Element.markNeedsBuild (package:flutter/src/widgets/framework.dart:3911:6)
I/flutter ( 9862): #2 State.setState (package:flutter/src/widgets/framework.dart:1168:14)
I/flutter ( 9862): #3 OverlayState.insertAll (package:flutter/src/widgets/overlay.dart:344:5)
I/flutter ( 9862): #4 OverlayRoute.install (package:flutter/src/widgets/routes.dart:44:24)
I/flutter ( 9862): #5 TransitionRoute.install (package:flutter/src/widgets/routes.dart:181:11)
I/flutter ( 9862): #6 ModalRoute.install (package:flutter/src/widgets/routes.dart:959:11)
I/flutter ( 9862): #7 NavigatorState.push (package:flutter/src/widgets/navigator.dart:1791:11)
I/flutter ( 9862): #8 showModalBottomSheet (package:flutter/src/material/bottom_sheet.dart:472:65)
1回答
-
CrazyCodeBoy
2020-01-15
在iOS模拟器上运行试一下看能否正常运行呢
00
相似问题