hid_monitor library

A cross-platform Flutter plugin for monitoring HID (Human Interface Device) events.

This plugin provides global keyboard and mouse event monitoring on Windows, macOS, and Linux platforms using FFI (Foreign Function Interface) to communicate with native libraries.

Features

  • Keyboard event monitoring (key down/up)
  • Mouse event monitoring (movement, buttons, scroll wheel)
  • Cross-platform support (Windows, macOS, Linux)
  • High-performance native library access

Getting Started

import 'package:hid_monitor/hid_monitor.dart';

void main() async {
  final backend = getListenerBackend();
  if (backend != null && backend.initialize()) {
    backend.addKeyboardListener((event) {
      print('Key event: $event');
    });
    backend.addMouseListener((event) {
      print('Mouse event: $event');
    });
  }
}

Platform Support

Platform Status
Windows
macOS
Linux

References

This project uses native libraries from hid_listener.

Classes

HidListenerBackend
Abstract base class for HID listener backends.
MouseButtonEvent
Event representing a mouse button press or release.
MouseEvent
Base class for all mouse events.
MouseMoveEvent
Event representing mouse movement.
MouseWheelEvent
Event representing mouse scroll wheel movement.

Enums

MouseButtonEventType
Enum representing the type of mouse button event.

Functions

getListenerBackend() HidListenerBackend?
Returns the global listener backend instance.