-
Notifications
You must be signed in to change notification settings - Fork 504
Description
i got error after upgrade to flutter 3.0
`======== Exception caught by widgets library =======================================================
The following assertion was thrown building Builder(dependencies: [MediaQuery]):
'package:flutter/src/widgets/framework.dart': Failed assertion: line 4864 pos 12: 'child == _child': is not true.
Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=2_bug.md
The relevant error-causing widget was:
Builder Builder:file:///Users/zeekands/.pub-cache/hosted/pub.dartlang.org/flutter_screenutil-5.5.2/lib/src/screenutil_init.dart:109:16
When the exception was thrown, this was the stack:
#2 ComponentElement.forgetChild (package:flutter/src/widgets/framework.dart:4864:12)
#3 Element._retakeInactiveElement (package:flutter/src/widgets/framework.dart:3752:14)
... Normal element mounting (301 frames)
#304 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3817:16)
#305 MultiChildRenderObjectElement.inflateWidget (package:flutter/src/widgets/framework.dart:6350:36)
#306 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6362:32)
... Normal element mounting (405 frames)
#711 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3817:16)
#712 Element.updateChild (package:flutter/src/widgets/framework.dart:3551:18)
#713 RenderObjectToWidgetElement._rebuild (package:flutter/src/widgets/binding.dart:1202:16)
#714 RenderObjectToWidgetElement.mount (package:flutter/src/widgets/binding.dart:1171:5)
#715 RenderObjectToWidgetAdapter.attachToRenderTree. (package:flutter/src/widgets/binding.dart:1119:18)
#716 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2597:19)
#717 RenderObjectToWidgetAdapter.attachToRenderTree (package:flutter/src/widgets/binding.dart:1118:13)
#718 WidgetsBinding.attachRootWidget (package:flutter/src/widgets/binding.dart:953:7)
#719 WidgetsBinding.scheduleAttachRootWidget. (package:flutter/src/widgets/binding.dart:933:7)
(elided 13 frames from class _AssertionError, class _RawReceivePortImpl, class _Timer, dart:async, and dart:async-patch)
W/Gralloc3(15955): mapper 3.x is not supported
======== Exception caught by widgets library =======================================================
The following assertion was thrown while finalizing the widget tree:
Duplicate GlobalKey detected in widget tree.
The following GlobalKey was specified multiple times in the widget tree. This will lead to parts of the widget tree being truncated unexpectedly, because the second time a key is seen, the previous instance is moved to the new location. The key was:
- [GlobalObjectKey int#675e6]
This was determined by noticing that after the widget with the above global key was moved out of its previous parent, that previous parent never updated during this frame, meaning that it either did not update at all or updated before the widget was moved, in either case implying that it still thinks that it should have a child with that global key.
The specific parent that did not update after having one or more children forcibly removed due to GlobalKey reparenting is: - Builder(dependencies: [MediaQuery])
A GlobalKey can only be specified on one widget at a time in the widget tree.
When the exception was thrown, this was the stack:
#0 BuildOwner.finalizeTree. (package:flutter/src/widgets/framework.dart:2991:15)
修改部分代码 #1 BuildOwner.finalizeTree (package:flutter/src/widgets/framework.dart:3016:8)
no message #2 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:893:19)
The release version does not work #3 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:370:5)
0.3.0 #4 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1146:15)
0.4.0优化字体适配方法 #5 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1083:9)
字体适配 #6 SchedulerBinding.scheduleWarmUpFrame. (package:flutter/src/scheduler/binding.dart:864:7)
(elided 11 frames from class _RawReceivePortImpl, class _Timer, dart:async, and dart:async-patch)
====================================================================================================
`