toJson method

Map<String, dynamic> toJson()

Creates a JSON from an existing DeviceMotionData

Implementation

Map<String, dynamic> toJson() => {
      "quaternionX": attitude.quaternion.x,
      "quaternionY": attitude.quaternion.y,
      "quaternionZ": attitude.quaternion.z,
      "quaternionW": attitude.quaternion.w,
      'pitch': attitude.pitch,
      'roll': attitude.roll,
      'yaw': attitude.yaw,
      'gravityX': gravity.x,
      'gravityY': gravity.y,
      'gravityZ': gravity.z,
      'rotationRateX': rotationRate.x,
      'rotationRateY': rotationRate.y,
      'rotationRateZ': rotationRate.z,
      'accelerationX': userAcceleration.x,
      'accelerationY': userAcceleration.y,
      'accelerationZ': userAcceleration.z,
      'magneticFieldX': calibratedMagneticField.field.x,
      'magneticFieldY': calibratedMagneticField.field.y,
      'magneticFieldZ': calibratedMagneticField.field.z,
      'magneticFieldAccuracy': calibratedMagneticField.accuracy.value,
      'heading': heading,
    };