DualSenseController class
High-level controller for a Sony DualSense (PS5) controller over USB.
Wraps DualSenseBindings to expose an idiomatic Dart API: connect opens the device and starts a background polling loop, onInputChanged emits a DualSenseState every time something physical changes on the controller (sticks, triggers, buttons, battery), and setLedColor commands the lightbar color.
Basic example:
final controller = DualSenseController(DualSenseBindings.macOS());
if (await controller.connect()) {
controller.onInputChanged.listen(print);
}
Call dispose when you're done with the controller to release the native device handle.
Constructors
- DualSenseController(DualSenseBindings _bindings)
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
onInputChanged
→ Stream<
DualSenseState> -
Emits a new DualSenseState every time something physically changes
on the controller (sticks, triggers, buttons, battery, audio jack).
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
connect(
) → Future< bool> - Initializes HIDAPI and opens the DualSense connected over USB.
-
dispose(
) → void - Closes the native device and the event stream.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setLedColor(
int r, int g, int b) → void - Commands the LED lightbar via 48-byte Output Reports (0x02).
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited