错误:断言失败:!_debugDuringDeviceUpdate 不是真正的颤振
Posted
技术标签:
【中文标题】错误:断言失败:!_debugDuringDeviceUpdate 不是真正的颤振【英文标题】:Error: Assertion failed: !_debugDuringDeviceUpdate is not true flutter 【发布时间】:2021-01-14 11:09:32 【问题描述】:当我在 Flutter Web 项目中添加一些像 ListView 这样的小部件时,我遇到了这个错误 我以前在使用 android 时从未遇到过它
Exception has occurred.
"Error: Assertion failed: file:///D:/Android/flutter/packages/flutter/lib/src/rendering/mouse_tracking.dart:312:12
!_debugDuringDeviceUpdate
is not true
at Object.throw_ [as throw] (http://localhost:23584/dart_sdk.js:4328:11)
at Object.assertFailed (http://localhost:23584/dart_sdk.js:4275:15)
at mouse_tracking.MouseTracker.new.[_deviceUpdatePhase] (http://localhost:23584/packages/flutter/src/rendering/layer.dart.lib.js:4940:61)
at http://localhost:23584/packages/flutter/src/rendering/layer.dart.lib.js:4998:33
at mouse_tracking.MouseTracker.new.[_monitorMouseConnection] (http://localhost:23584/packages/flutter/src/rendering/layer.dart.lib.js:4935:7)
at mouse_tracking.MouseTracker.new.updateWithEvent (http://localhost:23584/packages/flutter/src/rendering/layer.dart.lib.js:4997:36)
at binding$5.WidgetsFlutterBinding.new.dispatchEvent (http://localhost:23584/packages/flutter/src/rendering/layer.dart.lib.js:5943:45)
at binding$5.WidgetsFlutterBinding.new.[_handlePointerEvent] (http://localhost:23584/packages/flutter/src/gestures/binding.dart.lib.js:257:14)
at binding$5.WidgetsFlutterBinding.new.[_flushPointerEventQueue] (http://localhost:23584/packages/flutter/src/gestures/binding.dart.lib.js:229:35)
at binding$5.WidgetsFlutterBinding.new.[_handlePointerDataPacket] (http://localhost:23584/packages/flutter/src/gestures/binding.dart.lib.js:213:65)
at Object._invoke1 (http://localhost:23584/dart_sdk.js:175453:7)
at _engine.EngineWindow.new.invokeOnPointerDataPacket (http://localhost:23584/dart_sdk.js:171307:15)
at _engine.PointerBinding.__.[_onPointerData] (http://localhost:23584/dart_sdk.js:158211:24)
at http://localhost:23584/dart_sdk.js:158585:26
at http://localhost:23584/dart_sdk.js:158557:16
at http://localhost:23584/dart_sdk.js:158310:11"
我到处找,但没有任何线索 提前致谢
【问题讨论】:
请分享产生此错误的代码。 Dartpad 是展示此错误的好地方。 【参考方案1】:有时,资产需要重新渲染才能动态更新。所以, 不要热重新加载,而是尝试热重启,或关闭应用并重新构建它。
【讨论】:
如果这不起作用有什么想法吗? 这不是解决方案,因为您怎么知道在生产中有时您应该通过重新启动应用程序来启动您的应用程序?没有用。当 github 上的相关票证在几个月前关闭但问题仍然存在时,我在上次升级的颤振版本中看到了这个问题。【参考方案2】:我也面临同样的问题。但就我而言,我注意到还有另一个错误说
Vertical viewport was given unbounded height.
将这两行添加到 ListView 应该可以修复错误:
scrollDirection: Axis.vertical,
shrinkWrap: true,
【讨论】:
收缩包装对我的情况有所帮助...【参考方案3】:你能分享一下代码吗?因为我也遇到了同样的错误,但我已经解决了。
显然,我在 ListTile() 小部件的 Trailing
中使用了 Row() 小部件。所以我只是在我的 Row() 小部件中添加以下属性
mainAxisSize: MainAxisSize.min
但是,我仍然建议您也分享一段引发该错误的代码,以便有人更准确地提出答案。
【讨论】:
以上是关于错误:断言失败:!_debugDuringDeviceUpdate 不是真正的颤振的主要内容,如果未能解决你的问题,请参考以下文章
OpenCV VideoCapture 和错误:(-215:断言失败)!_src.empty() in function 'cv::cvtColor'
错误:(-215:断言失败)_step >= minstep in function 'cv::Mat::Mat'
调试断言失败:_CrtIsValidHeapPointer(pUserData)