xinput_gamepad 1.3.1 copy "xinput_gamepad: ^1.3.1" to clipboard
xinput_gamepad: ^1.3.1 copied to clipboard

Support to XInput controllers easily with cool features and a good abstraction.

xinput_gamepad #

Add support to XInput controllers with Win32 API. #

badge_version badge_license badge_sdk badge_platform

Dependencies #

Features #

  • Handle controller inputs easily;
  • Get controllers information (Battery type, battery level, controller type and more);
  • Get connected controllers;
  • Set more than one button mapping per controller;
  • Set input lag and controller's deadzone;
  • Set and use controller's vibration motor;

Instalation #

With Dart

dart pub add xinput_gamepad

With Flutter

flutter pub add xinput_gamepad

See more in install section

Simple example #

Enable XInput:

XInputManager.enableXInput();

Init and map the controller:

final Controller controller = Controller(index: 0);
controller.buttonsMapping = {
  ControllerButton.A_BUTTON: () =>
      print("Controller $controllerIndex - Button A"),
  ControllerButton.B_BUTTON: () =>
      print("Controller $controllerIndex - Button B"),
  ControllerButton.X_BUTTON: () =>
      print("Controller $controllerIndex - Button X"),
  ControllerButton.Y_BUTTON: () =>
      print("Controller $controllerIndex - Button Y"),
};

//Start to listen inputs
controller.listen();

You can get the indexes of the available/connected controllers with:

ControllersManager.getIndexConnectedControllers();

See all practical examples here

Documentation #

Access the documentation here

3
likes
150
pub points
63%
popularity

Publisher

unverified uploader

Support to XInput controllers easily with cool features and a good abstraction.

Repository (GitHub)
View/report issues

Documentation

Documentation
API reference

License

MIT (license)

Dependencies

collection, ffi, win32

More

Packages that depend on xinput_gamepad