Flutter Shortcuts physical key is pressed on a different logical key

345 Views Asked by At

I build flutter app for android TV, but I have issue with the IR remote when I press OK key

A KeyUpEvent is dispatched, but the state shows that the physical key is pressed on a different logical key. If this occurs in real application, please report this bug to Flutter. If this occurs in unit tests, please ensure that simulated events follow Flutter's event model as documented in HardwareKeyboard. This was the event: KeyUpEvent#f6347(physicalKey: PhysicalKeyboardKey#70077(usbHidUsage: "0x00070077", debugName: "Select"), logicalKey: LogicalKeyboardKey#00101(keyId: "0x200000101", keyLabel: "Control Right", debugName: "Control Right"), character: null, timeStamp: 0:00:08.820516, synthesized) and the recorded logical key LogicalKeyboardKey#0050c(keyId: "0x10000050c", keyLabel: "Select", debugName: "Select")

  shortcuts: <LogicalKeySet, Intent>{
    LogicalKeySet(LogicalKeyboardKey.select,): const ActivateIntent(),
  },```
1

There are 1 best solutions below

1
On

after many searches and tests, i reached the following and worked well.

in hardware_keyboard.dart search for void _assertEventIsRegular method and add the following before the if (event is KeyDownEvent)

added script:

if (event.physicalKey == PhysicalKeyboardKey.controlRight) {
         return true;
      }