Flutter Web : "Should never encounter KeyData when transitMode is rawKeyData."

2,680

Solution 1

try one of theies

flutter run -d chrome --web-renderer html

flutter build web --web-renderer html

Solution 2

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.

Solution 3

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!

Share:
2,680
hasanm08
Author by

hasanm08

Updated on January 02, 2023

Comments

  • hasanm08
    hasanm08 over 1 year

    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
    
  • Patel Pinkal
    Patel Pinkal almost 2 years
    can you please provide more detail