MouseDevice class final
The mouse. MouseControls.delta and MouseControls.scroll add up what happened since the last update and start again from zero at each; their running totals (InputControl.readTotal) never start again, for reading once per rendered frame instead.
Movement comes from Flutter's pointer events, or from outside them through injectDelta — a locked pointer's raw movement. While relativeMode is on, only the injected movement counts.
- Inheritance
-
- Object
- InputDevice
- StatefulDevice<
MouseState> - MouseDevice
Constructors
- MouseDevice({required int deviceId})
Properties
- applied ↔ MouseState
-
getter/setter pairinherited
- appliedState → Object
-
no setterinherited
- connected ↔ bool
-
False once it has gone. A player holding a device that went is waiting
for it to come back.
getter/setter pairinherited
-
controls
→ List<
InputControl> -
Every control a binding can name on this device, children included.
no setteroverride
- deviceId → int
-
Unique for the session. A pad that is unplugged and plugged back in is
a new device with a new id.
finalinherited
- displayName ↔ String
-
What a player sees:
Xbox Wireless Controller.getter/setter pairinherited - hashCode → int
-
The hash code for this object.
no setterinherited
- layout → String
-
A layout name:
Keyboard,Gamepad.finalinherited - live ↔ MouseState
-
getter/setter pairinherited
- liveState → Object
-
no setterinherited
- relativeMode ↔ bool
-
Movement comes from injectDelta alone: the pointer is locked, its
cursor hidden and held in place, and the pointer events' own movement
(a hidden cursor nudged against its clip) would count it twice. Their
buttons and position still count. Off by default.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- settings ↔ InputSettingsDef Function()
-
Asset settings the device reads — dead zones.
getter/setter pairinherited
- sink ↔ DeviceSink?
-
Set by the service that owns this device.
getter/setter pairinherited
Methods
-
applyNext(
) → void -
Applies the oldest queued change to the applied state. The service
calls this once per queued change, in order.
inherited
-
beginUpdate(
) → bool -
Called at the start of every update, before the queue is replayed:
clears what only lasts one update (mouse movement, wheel). True when
something changed.
override
-
control(
String name) → InputControl? -
The control called
name—space,leftStick/up— or null.override -
handlePointerEvent(
PointerEvent event) → void -
injectDelta(
Offset delta) → void -
Adds
deltato the mouse's movement as though the pointer had moved: raw movement from outside Flutter's pointer events, such as a locked pointer's (PointerLock).<Mouse>/deltasees it at the next update, and a frame-at-a-time read (FrameMotion) at once. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
queue(
void change(MouseState state)) → void -
Makes
changenow to the live state, and queues it for the applied state. With no service yet, both change at once.inherited -
releaseAll(
) → void -
settle(
) → void -
Brings the applied state level with the live one without replaying —
for a device that was just added, whose history nobody needs.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited