Stream macOS HID activity to Flutter


  • stream HID events such as mouse activity or keyboard key press on macOS
  • request & check accessibility permissions


Your app must not run in sandbox. Change in DebugProfile.entitlements and Release.entitlements:



Import this package, create instance and call getActivityStream() to get event stream

class MyHomePage extends StatelessWidget {
  MyHomePage({Key? key}) : super(key: key);

  final _hidActivityMacos = HidActivityMacos();

  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: StreamBuilder<String> (
          stream: _hidActivityMacos.getActivityStream,
          builder: (context, AsyncSnapshot<String> snapshot) {
            if(snapshot.hasData) {
              return Text(snapshot.data!);
            } else {
              return const Text('Waiting for HID event');