Error: Assertion failed: !_debugDuringDeviceUpdate is not true flutter

31.3k views Asked by At

I am facing this error when using adding some widgets like ListView to a flutter web project I never faced it before when working with 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"

I looked everywhere but with no clues thanks in advance

7

There are 7 answers

0
Ayesha Iftikhar On

Can you please share the code? Because I also faced the same error but I have resolved it. Apparently, I was using a Row() widget in the Trailing of my ListTile() widget. So I just add the following property in my Row() widget

mainAxisSize: MainAxisSize.min

But, I still suggest you please share the piece of code too which is throwing that error so that someone suggests an answer more accurately.

3
ervans589 On

Sometimes, assets need re-rendering in order to update dynamically. So, Instead of hot reloading, try hot restarting, or close the app and rebuild it.

0
user1634451 On

I had the same problem with a row and needed to put Expaned() around the list view

0
George Freire On

My solution was to enlarge the screen with the size property of the Container

Container(
        width: MediaQuery.of(_buildContext!).size.width 
)
0
Denxorz On

Accidentially swapping a Column for a Row might also stir up errors like these.

0
Reetesh Ranjan On

I had this assertion failure happening because I was using a MouseRegion subtree, where the onEnter/onExit handlers were throwing an uncaught exception specific to my app. Once the app's exception occurred, this assertion failure occurred, and after that no clickable element will show the proper cursor.

Once I got rid of the uncaught exception coming form onEnter/onExit handlers, this assertion failure stopped happening.

https://github.com/flutter/flutter/issues/84241#issuecomment-1236344314.

1
Devang Raj Arora On

I was also facing the same issue. But in my case I noticed there was another error which said

Vertical viewport was given unbounded height.

Adding these two lines to ListView should fix the error:

scrollDirection: Axis.vertical,
shrinkWrap: true,