updateAllDevices method Null safety

void updateAllDevices (
  1. MouseDetectorAnnotationFinder hitTest

Trigger a device update for all detected devices.

The updateAllDevices is typically called during the post frame phase, indicating a frame has passed and all objects have potentially moved. The hitTest is a function that can acquire the hit test result at a given position, and must not be empty.

For each connected device, the updateAllDevices will make a hit test on the device's last seen position, generate the new state for the pointer based on given information, and call handleDeviceUpdate based on the state changes.


void updateAllDevices(MouseDetectorAnnotationFinder hitTest) {
  _deviceUpdatePhase(() {
    for (final _MouseState dirtyState in _mouseStates.values) {
      final PointerEvent lastEvent = dirtyState.latestEvent;
      final LinkedHashMap<MouseTrackerAnnotation, Matrix4> nextAnnotations = _findAnnotations(dirtyState, hitTest);
      final LinkedHashMap<MouseTrackerAnnotation, Matrix4> lastAnnotations = dirtyState.replaceAnnotations(nextAnnotations);

        lastAnnotations: lastAnnotations,
        nextAnnotations: nextAnnotations,
        previousEvent: lastEvent,