How can I collect chars from external keyboard and append to a var without having a text field? Im trying to setup a Bluetooth/USB barcode scanner to automatically to someth
I am in the same position and after some researches, I believe that RawKeyboardListener is actually not the best thing to use. Instead, there's a Widget called FocusScope that appears to be a perfect fit for this purpose. The best thing about this Widget is that its onKey event won't be triggered by any text field, nor will it be triggered by soft keyboard.
RawKeyboardListener
allows to do that https://docs.flutter.io/flutter/widgets/RawKeyboardListener-class.html
var _focusNode = FocusNode();
@override
Widget build(BuildContext context) {
return RawKeyboardListener(
child: Text('raw keyboard input'),
focusNode: _focusNode,
onKey: _onRawKeyEvent,
);
}
void _onRawKeyEvent(RawKeyEvent event) {
..
}