'Error: Assertion failed: !_debugDuringDeviceUpdate is not true flutter

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



Solution 1:[1]

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.

Solution 2:[2]

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,

Solution 3:[3]

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.

Solution 4:[4]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ervans589
Solution 2 Devang Raj Arora
Solution 3 Ayesha Iftikhar
Solution 4 user1634451