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 something when scanned but not that you have to click a field (or see one) And have a credit card reader Automatically do everything in the background..
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) {
..
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With