Gamepad class abstract
A physical gamepad that can be connected and used to control the rover.
To interact with a gamepad, create an instance of this class. This class is completely safe to use even if the gamepad in question is not connected or suddenly disconnects. Check isConnected if you need to know the current state of the gamepad.
Use Gamepad.forPlatform to get the right implementation for the current platform.
Constructors
- Gamepad(int controllerIndex)
- Creates a new gamepad object, whether it is connected or not.
- Gamepad.forPlatform(int index)
-
Returns a functional instance of this class, or a mock on unsupported platforms.
factory
Properties
- batteryLevel → GamepadBatteryLevel
-
The current battery of the controller, or GamepadBatteryLevel.unknown if disconnected.
no setter
- controllerIndex → int
-
The unique number assigned to this controller by the operating system.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isConnected → bool
-
Whether the gamepad is currently connected.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
dispose(
) → Future< void> -
Cleans up any resources used by the service.
inherited
-
getState(
) → GamepadState? - Gets the current state of the gamepad, or null if it's not connected.
-
init(
) → Future< void> -
Initializes the service.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pulse(
) → void - Makes the gamepad vibrate a small "pulse"
-
stopVibrating(
) → void - Stops vibrating the controller.
-
toString(
) → String -
A string representation of this object.
inherited
-
vibrate(
{double intensity = 1}) → void - Vibrates the gamepad at the given intensity, from a scale of 0.0 to 1.0.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited