/hid_listener_fork

Keyboard/Mouse event listener library for flutter

Primary LanguageCMIT LicenseMIT

hid_listener

HidListener is a library that allows you to listen to hid events cross-platform.

Windows

Add this into your main.cpp file

#include <hid_listener/hid_listener_plugin_windows.h>

and add this inside wWinMain funciton

HidListener listener;

MacOS

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()
...

Linux

Add this into your main.cc file

#include <hid_listener/hid_listener_plugin.h>

and add this inside main funciton

HidListener listener;

Dart

To register for keyboard events from the dart side use registerKeyboardListener

Example:

registerKeyboardListener((event) {
  print("${event.logicalKey.keyLabel}");
});