Attitude.fromMap constructor

Attitude.fromMap(
  1. dynamic attitudeMap
)

Creates an Attitude instance from a map representation.

Typically used when deserializing attitude data received from the native platform.

The map should contain:

  • quaternion: A map with x, y, z, w values
  • time: Optional timestamp (reserved for future use)
  • accuracy: Optional accuracy value (reserved for future use)
  • headingDegrees: The heading in degrees
  • headingRadians: The heading in radians

Implementation

factory Attitude.fromMap(dynamic attitudeMap) {
  return Attitude(
      quaternion: QuaternionExtension.fromMap(attitudeMap["quaternion"]),
      time: attitudeMap["time"] as int?,
      accuracy: attitudeMap["accuracy"] as double?,
      headingDegrees: attitudeMap["headingDegrees"] as double,
      headingRadians: attitudeMap["headingRadians"] as double);
}