pointer_lock library

Locks the mouse pointer in place and reports its motion as relative deltas.

Flutter exposes no pointer lock on any desktop platform, which makes a first-person camera impossible out of the box: the cursor reaches the edge of the window and the view stops turning.

Pull, not push

The delta is drained with PointerLock.takeDelta rather than delivered by a stream. That is the shape a game wants. A simulation running on a fixed timestep asks "how far did the mouse move since the last step" once per step; handing it a stream of individual mouse events only moves the accumulation into every caller, and each of them has to get it right.

Classes

PointerLock
Pointer capture, and the motion accumulated while it is held.
PointerLockPlatform
The platform side of pointer capture.

Enums

CaptureState
Whether the pointer is currently held.