GamepadController class

Represents a single, currently connected joystick controller (or gamepad).

By calling the constructor, this object will automatically subscribe to events and update its internal state. To stop listening, be sure to call dispose. Failing to do so may result in the object leaking memory.

Constructors

GamepadController({required String id, required String name, required GamepadsPlatformInterface plugin, int? vendorId, int? productId})
GamepadController.parse(Map map, GamepadsPlatformInterface plugin)
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
id String
A unique identifier for the gamepad controller.
final
name String
A user-facing, platform-dependant name for the gamepad controller.
final
productId int?
The USB product ID of the controller, if available.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state GamepadState
final
vendorId int?
The USB vendor ID of the controller, if available.
final

Methods

dispose() Future<void>
Stops listening for new inputs.
hasRumble() Future<bool>
Whether this controller currently supports vibration.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
rumble({double lowFrequency = 0, double highFrequency = 0, Duration duration = const Duration(milliseconds: 500)}) Future<bool>
Replaces the current vibration with a finite dual-motor effect. Zero amplitudes or zero duration stop it. Unsupported devices return false.
stopRumble() Future<bool>
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited