GamepadState class

Tracks the state of all connected gamepads.

Constructors

GamepadState()

Properties

connected → Iterable<SingleGamepadState>
Get all connected gamepads.
no setter
gamepads → Map<String, SingleGamepadState>
All connected gamepads by ID.
final
hashCode → int
The hash code for this object.
no setterinherited
primary → SingleGamepadState?
Get the first connected gamepad, or null.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

beginFrame() → void
Called at the start of each frame.
clear() → void
Clear all gamepads.
disconnect(String id) → void
Mark a gamepad as disconnected.
endFrame() → void
Called at the end of each frame to clear transition flags.
get(String id) → SingleGamepadState?
Get a gamepad by ID.
getAxis(String key, {String? gamepadId}) → double
Get an axis value from any gamepad.
getButtonPhase(String key, {String? gamepadId}) → ButtonPhase
Get button phase from any gamepad.
getOrCreate(String id, String name) → SingleGamepadState
Get or create a gamepad state.
isButtonPressed(String key, {String? gamepadId}) → bool
Check if a button is pressed on any gamepad.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remove(String id) → void
Remove a disconnected gamepad.
toString() → String
A string representation of this object.
inherited

Operators

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