CompassEvent.fromList constructor

CompassEvent.fromList(
  1. List<double>? data
)

Reads the platform payload: [heading, headingForCameraMode, accuracy], followed by the 9 values of rotationMatrix when available, then by the orientation (an index of DeviceOrientation.values, -1 when unknown). Payloads without the orientation (3 or 12 values) are still read.

Implementation

CompassEvent.fromList(List<double>? data)
  : heading = data?[0],
    headingForCameraMode = data?[1],
    accuracy = (data == null) || (data[2] == -1) ? null : data[2],
    rotationMatrix = data != null && data.length >= 12
        ? List<double>.unmodifiable(data.sublist(3, 12))
        : null,
    orientation = _orientation(data);