HidListener is a library that allows you to listen to hid events cross-platform.
Add this into your main.cpp
file
#include <hid_listener/hid_listener_plugin_windows.h>
and add this inside wWinMain
funciton
HidListener listener;
Add this into your MainFlutterWindow.swift
file
import hid_listener
and add this inside MainFlutterWindow
class
let listener = HidListener()
The file should now look something like this:
...
import hid_listener
class MainFlutterWindow: NSWindow {
let listener = HidListener()
...
Add this into your main.cc
file
#include <hid_listener/hid_listener_plugin.h>
and add this inside main
funciton
HidListener listener;
To register for keyboard events from the dart side use registerKeyboardListener
Example:
registerKeyboardListener((event) {
print("${event.logicalKey.keyLabel}");
});