How to use TextFormField widgets with device in keyboard emulator - FLUTTER

53 Views Asked by At

I am new to flutter so if you have a better solution I am all ears. I am writing a flutter for badging the work hours. Employees would scan with their badge with an nfc reader to record the starting / closing time of work shift. The NFC reader is a plug and play USB reader; these readers work in keyboard emulation, meaning that I do not need to activate the reader with nfc packages to get the uid stored in the nfc tag memory.

At the moment I put a Form -> TextFormField in which the uid string can be written when the badge is scanned. Of course this way the user doesnt have to write anything with physical keys, so I get the error (currently testing as desktop app):

The following assertion was thrown during a platform message callback: Attempted to send a key down event when no keys are in keysPressed. This state can occur if the key event being sent doesn't properly set its modifier flags. This was the event: RawKeyDownEvent#8eec3(logicalKey: LogicalKeyboardKey#df100(keyId: "0x200000102", keyLabel: "Shift Left", debugName: "Shift Left"), physicalKey: PhysicalKeyboardKey#ed430(usbHidUsage: "0x000700e1", debugName: "Shift Left"), repeat: false) and its data: RawKeyEventDataWindows#30a45(keyCode: 160, scanCode: 42, characterCodePoint: 0, modifiers: 0) 'package:flutter/src/services/raw_keyboard.dart': raw_keyboard.dart:1 Failed assertion: line 695 pos 7: 'event is! RawKeyDownEvent || _keysPressed.isNotEmpty'

While partially writing in the TextFormField text field the string read by the reader.

Of course the best and ideal solution for me would be to read the nfc tag in background, and in background use the string to retreive the information about the employee. If you have any advice on how to implement this it would be great. Otherwise I would be very thankful for any other advice on how to write in KeyEmu in a text field.

Thanks

0

There are 0 best solutions below