12

When I run my project on web the Exception message and stack trace was

"Should never encounter KeyData when transitMode is rawKeyData."
    at Object.throw_ [as throw] (http://localhost:2621/dart_sdk.js:5061:11)
    at Object.assertFailed (http://localhost:2621/dart_sdk.js:4986:15)
    at hardware_keyboard.KeyEventManager.new.handleKeyData (http://localhost:2621/packages/flutter/src/services/restoration.dart.lib.js:5334:28)
    at http://localhost:2621/dart_sdk.js:160131:47
    at Object.invoke (http://localhost:2621/dart_sdk.js:179656:7)
    at _engine.EnginePlatformDispatcher.__.invokeOnKeyData (http://localhost:2621/dart_sdk.js:160131:17)
    at _engine.KeyboardBinding.__.[_onKeyData] (http://localhost:2621/dart_sdk.js:158922:49)
    at _engine.KeyboardConverter.new.handleEvent (http://localhost:2621/dart_sdk.js:159210:16)
    at http://localhost:2621/dart_sdk.js:158929:74
    at loggedHandler (http://localhost:2621/dart_sdk.js:158906:43)
Error: Assertion failed: file:///E:/flutter_windows_2.5.2-stable/flutter/packages/flutter/lib/src/services/hardware_keyboard.dart:787:16
hasanm08
  • 488
  • 4
  • 13
  • 1
    Related GitHub issue ticket: https://github.com/flutter/flutter/issues/89729. While the ticket reports that the issue occurs on Linux build, feedback from other developers indicate that the seems to happen on web as well. – Omatt Nov 18 '21 at 14:21

5 Answers5

12

try one of theies

flutter run -d chrome --web-renderer html

flutter build web --web-renderer html

hasanm08
  • 488
  • 4
  • 13
5

If you are getting problem on Device or Emulator or Simulator, Just close the app and Run again.

In my case, I have initialised controller in init method and I changed something related to controller so its needs to be updated. That's why we need to rerun again.

P.S. I thought to restart the app but doesn't worked for me.

Pratik Butani
  • 60,504
  • 58
  • 273
  • 437
1

I am encountering this issue here and there also. I'm getting it while using emulator/simulator on MacOS. This completely kills the app on the simulator, hot-reload does NOT fix this, after hot-reload the app is completely frozen.

The only way for me to fix this is to completely quit simulator & VS Code project. Reload VS Code project and simulator and it works again.

This is a horrible issue & seriously interrupts development & production. Hope it gets fixed soon!

RobbB
  • 1,214
  • 11
  • 39
0

In my case, it was related to my widgets state which was connected to a GetX controller which was never injected to the widget tree. So it was complaining about the not initialized state with a awkward log.

Stephen Ostermiller
  • 23,933
  • 14
  • 88
  • 109
0

just do full re run the application.

Ritunjay kumar
  • 261
  • 3
  • 6