我有个内容很多的 Widget 一更新就卡死,开始以为是我响应式代码写得不对,查了半天,发现这个错误是 Windows 平台上的 bug,不影响 Android APP 正常使用。报错信息太长放下面了。
══╡ EXCEPTION CAUGHT BY SCHEDULER LIBRARY ╞═════════════════════════════════════════════════════════
The following assertion was thrown during a scheduler callback:
Cannot hit test a render box that has never been laid out.
The hitTest() method was called on this RenderBox: RenderLimitedBox#f00f0 NEEDS-LAYOUT NEEDS-PAINT:
creator: LimitedBox ← Container ← PieChartLeaf ← PieChart ← Obx ← SizedBox ← RepaintBoundary ←
IndexedSemantics ← NotificationListener<KeepAliveNotification> ← KeepAlive ← AutomaticKeepAlive ←
KeyedSubtree ← ⋯
parentData: offset=Offset(0.0, 0.0); id=null
constraints: MISSING
size: MISSING
maxWidth: 0.0
maxHeight: 0.0
Unfortunately, this object's geometry is not known at this time, probably because it has never been
laid out. This means it cannot be accurately hit-tested.
If you are trying to perform a hit test during the layout phase itself, make sure you only hit test
nodes that have completed layout (e.g. the node's children, after their layout() method has been
called).
When the exception was thrown, this was the stack:
#0 RenderBox.hitTest.<anonymous closure> (package:flutter/src/rendering/box.dart:2381:11)
#1 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2412:6)
#2 RenderBoxContainerDefaultsMixin.defaultHitTestChildren.<anonymous closure> (package:flutter/src/rendering/box.dart:2775:25)
#3 BoxHitTestResult.addWithPaintOffset (package:flutter/src/rendering/box.dart:787:31)
#4 RenderBoxContainerDefaultsMixin.defaultHitTestChildren (package:flutter/src/rendering/box.dart:2770:33)
#5 RenderPieChart.hitTestChildren (package:fl_chart/src/chart/pie_chart/pie_chart_renderer.dart:121:12)
#6 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#7 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#8 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#9 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#10 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#11 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#12 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#13 RenderSliverHelpers.hitTestBoxChild.<anonymous closure> (package:flutter/src/rendering/sliver.dart:1668:22)
#14 BoxHitTestResult.addWithOutOfBandPosition (package:flutter/src/rendering/box.dart:884:31)
#15 RenderSliverHelpers.hitTestBoxChild (package:flutter/src/rendering/sliver.dart:1665:19)
#16 RenderSliverMultiBoxAdaptor.hitTestChildren (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:558:11)
#17 RenderSliver.hitTest (package:flutter/src/rendering/sliver.dart:1287:11)
#18 SliverHitTestResult.addWithAxisOffset (package:flutter/src/rendering/sliver.dart:857:31)
#19 RenderSliverEdgeInsetsPadding.hitTestChildren (package:flutter/src/rendering/sliver_padding.dart:219:14)
#20 RenderSliver.hitTest (package:flutter/src/rendering/sliver.dart:1287:11)
#21 RenderViewportBase.hitTestChildren.<anonymous closure> (package:flutter/src/rendering/viewport.dart:711:24)
#22 BoxHitTestResult.addWithOutOfBandPosition (package:flutter/src/rendering/box.dart:884:31)
#23 RenderViewportBase.hitTestChildren (package:flutter/src/rendering/viewport.dart:708:33)
#24 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#25 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#26 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#27 RenderIgnorePointer.hitTest (package:flutter/src/rendering/proxy_box.dart:3257:31)
#28 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#29 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#30 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#31 RenderProxyBoxWithHitTestBehavior.hitTest (package:flutter/src/rendering/proxy_box.dart:178:19)
#32 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#33 RenderProxyBoxWithHitTestBehavior.hitTest (package:flutter/src/rendering/proxy_box.dart:178:19)
#34 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#35 RenderProxyBoxWithHitTestBehavior.hitTest (package:flutter/src/rendering/proxy_box.dart:178:19)
#36 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#37 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#38 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#39 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#40 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#41 RenderCustomPaint.hitTestChildren (package:flutter/src/rendering/custom_paint.dart:535:18)
#42 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#43 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#44 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#45 RenderMouseRegion.hitTest (package:flutter/src/rendering/proxy_box.dart:2905:18)
#46 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#47 RenderProxyBoxWithHitTestBehavior.hitTest (package:flutter/src/rendering/proxy_box.dart:178:19)
#48 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#49 RenderProxyBoxWithHitTestBehavior.hitTest (package:flutter/src/rendering/proxy_box.dart:178:19)
#50 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#51 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#52 RenderBoxContainerDefaultsMixin.defaultHitTestChildren.<anonymous closure> (package:flutter/src/rendering/box.dart:2775:25)
#53 BoxHitTestResult.addWithPaintOffset (package:flutter/src/rendering/box.dart:787:31)
#54 RenderBoxContainerDefaultsMixin.defaultHitTestChildren (package:flutter/src/rendering/box.dart:2770:33)
#55 RenderFlex.hitTestChildren (package:flutter/src/rendering/flex.dart:1072:12)
#56 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#57 RenderBoxContainerDefaultsMixin.defaultHitTestChildren.<anonymous closure> (package:flutter/src/rendering/box.dart:2775:25)
#58 BoxHitTestResult.addWithPaintOffset (package:flutter/src/rendering/box.dart:787:31)
#59 RenderBoxContainerDefaultsMixin.defaultHitTestChildren (package:flutter/src/rendering/box.dart:2770:33)
#60 RenderCustomMultiChildLayoutBox.hitTestChildren (package:flutter/src/rendering/custom_layout.dart:414:12)
#61 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#62 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#63 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#64 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#65 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#66 RenderPhysicalModel.hitTest (package:flutter/src/rendering/proxy_box.dart:1889:18)
#67 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#68 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#69 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#70 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#71 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#72 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#73 RenderIgnorePointer.hitTest (package:flutter/src/rendering/proxy_box.dart:3257:31)
#74 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#75 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#76 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#77 RenderFractionalTranslation.hitTestChildren.<anonymous closure> (package:flutter/src/rendering/proxy_box.dart:2714:22)
#78 BoxHitTestResult.addWithPaintOffset (package:flutter/src/rendering/box.dart:787:31)
#79 RenderFractionalTranslation.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:2708:19)
#80 RenderFractionalTranslation.hitTest (package:flutter/src/rendering/proxy_box.dart:2694:12)
#81 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#82 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#83 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#84 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#85 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#86 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#87 RenderOffstage.hitTest (package:flutter/src/rendering/proxy_box.dart:3376:31)
#88 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#89 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#90 _RenderTheatre.hitTestChildren.<anonymous closure> (package:flutter/src/widgets/overlay.dart:765:25)
#91 BoxHitTestResult.addWithPaintOffset (package:flutter/src/rendering/box.dart:787:31)
#92 _RenderTheatre.hitTestChildren (package:flutter/src/widgets/overlay.dart:760:33)
#93 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#94 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#95 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#96 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#97 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#98 RenderAbsorbPointer.hitTest (package:flutter/src/rendering/proxy_box.dart:3474:17)
#99 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#100 RenderProxyBoxWithHitTestBehavior.hitTest (package:flutter/src/rendering/proxy_box.dart:178:19)
#101 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#102 RenderCustomPaint.hitTestChildren (package:flutter/src/rendering/custom_paint.dart:535:18)
#103 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#104 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#105 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#106 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#107 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#108 RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:131:19)
#109 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2414:11)
#110 RenderView.hitTest (package:flutter/src/rendering/view.dart:173:14)
#111 RenderView.hitTestMouseTrackers (package:flutter/src/rendering/view.dart:190:5)
#112 MouseTracker._findAnnotations (package:flutter/src/rendering/mouse_tracker.dart:257:47)
#113 MouseTracker.updateAllDevices.<anonymous closure> (package:flutter/src/rendering/mouse_tracker.dart:353:80)
#114 MouseTracker._deviceUpdatePhase (package:flutter/src/rendering/mouse_tracker.dart:206:9)
#115 MouseTracker.updateAllDevices (package:flutter/src/rendering/mouse_tracker.dart:350:5)
#116 RendererBinding._scheduleMouseTrackerUpdate.<anonymous closure> (package:flutter/src/rendering/binding.dart:345:22)
#117 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1144:15)
#118 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1090:9)
#119 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:998:5)
#123 _invoke (dart:ui/hooks.dart:163:10)
#124 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:259:5)
#125 _drawFrame (dart:ui/hooks.dart:126:31)
(elided 3 frames from dart:async)
════════════════════════════════════════════════════════════════════════════════════════════════════
Another exception was thrown: 'package:flutter/src/rendering/mouse_tracker.dart': Failed assertion: line 201 pos 12: '!_debugDuringDeviceUpdate': is not true.
Another exception was thrown: 'package:flutter/src/rendering/mouse_tracker.dart': Failed assertion: line 201 pos 12: '!_debugDuringDeviceUpdate': is not true.
Another exception was thrown: 'package:flutter/src/rendering/mouse_tracker.dart': Failed assertion: line 201 pos 12: '!_debugDuringDeviceUpdate': is not true.
Another exception was thrown: 'package:flutter/src/rendering/mouse_tracker.dart': Failed assertion: line 201 pos 12: '!_debugDuringDeviceUpdate': is not true.
Another exception was thrown: 'package:flutter/src/rendering/mouse_tracker.dart': Failed assertion: line 201 pos 12: '!_debugDuringDeviceUpdate': is not true.
[ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: 'package:flutter/src/rendering/mouse_tracker.dart': Failed assertion: line 201 pos 12: '!_debugDuringDeviceUpdate': is not true.
#0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:46:39)
#1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5)
#2 MouseTracker._deviceUpdatePhase (package:flutter/src/rendering/mouse_tracker.dart:201:12)
#3 MouseTracker.updateWithEvent.<anonymous closure> (package:flutter/src/rendering/mouse_tracker.dart:309:7)
#4 MouseTracker._monitorMouseConnection (package:flutter/src/rendering/mouse_tracker.dart:190:9)
#5 MouseTracker.updateWithEvent (package:flutter/src/rendering/mouse_tracker.dart:308:5)
#6 RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:285:22)
#7 GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:374:7)
#8 GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:338:5)
#9 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:296:7)
#10 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:279:7)
#11 _rootRunUnary (dart:async/zone.dart:1370:13)
#12 _CustomZone.runUnary (dart:async/zone.dart:1265:19)
#13 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1170:7)
#14 _invoke1 (dart:ui/hooks.dart:182:10)
#15 PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:282:7)
#16 _dispatchPointerDataPacket (dart:ui/hooks.dart:96:31)