Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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
like image 938
hasanm08 Avatar asked Oct 31 '21 06:10

hasanm08


2 Answers

try one of theies

flutter run -d chrome --web-renderer html

flutter build web --web-renderer html

like image 122
hasanm08 Avatar answered Oct 08 '22 18:10

hasanm08


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.

like image 44
Pratik Butani Avatar answered Oct 08 '22 16:10

Pratik Butani