mouse 1.0.0 copy "mouse: ^1.0.0" to clipboard
mouse: ^1.0.0 copied to clipboard

Simple mouse control for Dart using FFI, for desktop platforms.

A simple, low-dependency and cross-platform mouse control library for Dart.

This package provides primitive mouse control functionality for desktop platforms. It supports both Windows and macOS, allowing you to programmatically control mouse movements and clicks.

Features #

  • Get current mouse cursor position
  • Move mouse cursor to specific coordinates
  • Perform left and right clicks
  • Support for different mouse buttons (left, right, middle)
  • Cross-platform support (Windows and macOS)

Getting started #

Add the package to your pubspec.yaml:

dependencies:
  mouse: ^1.0.0

Usage #

Here's a simple example that prints the current mouse position every 100 milliseconds:

import 'dart:async';
import 'package:mouse/mouse.dart';

void main() {
  Timer.periodic(const Duration(milliseconds: 100), (timer) {
    final position = getPosition();
    print('Current mouse position: $position');
  });
}

To move the mouse cursor to a specific position:

import 'package:mouse/mouse.dart';

void main() {
  // Move to coordinates (100, 100)
  moveTo(Point(100, 100));
}

To perform a click:

import 'package:mouse/mouse.dart';

void main() {
  // Left click
  click();
  
  // Right click
  rightClick();
}

Additional information #

This package uses FFI to interact with the native system APIs:

  • Windows: Uses the Win32 API through the win32 package
  • macOS: Uses CoreGraphics through the objective_c package

For more information about the implementation details, please refer to the source code in the lib/src directory.

8
likes
0
points
0
downloads

Publisher

unverified uploader

Weekly Downloads

Simple mouse control for Dart using FFI, for desktop platforms.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

ffi, objective_c, win32

More

Packages that depend on mouse