12

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

Ahmed Rajab
  • 603
  • 3
  • 10
  • 28
  • Please share the piece of code which produces this error. [Dartpad](https://dartpad.dartlang.org/flutter) is a good place to show case this error. – Abhilash Chandran Sep 29 '20 at 10:42

5 Answers5

19

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.

ervans589
  • 199
  • 1
  • 3
  • 1
    Any ideas if that doesn't work? – sleighty Oct 13 '21 at 01:28
  • 2
    It's not the solution because how do you know in production that sometime you should start your app with restarting your app? It's pointless. I see this problem with the last upgraded flutter version when the associated ticket on github has closed about couple months ago but the problem is still here. – JavaRunner Jan 04 '22 at 23:09
  • just restart android studio ,hahhaha – Chunsheng Wei Apr 11 '22 at 03:16
9

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,
2

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.

Ayesha Iftikhar
  • 358
  • 3
  • 13
0

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

user1634451
  • 5,133
  • 6
  • 30
  • 43
0

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.