serialize method Null safety

void serialize(
  1. ByteDataWriter writer
)
override

Implementation

void serialize(ByteDataWriter writer) {
  // Serializes a message object of type TwistWithCovariance
  // Serialize message field [twist]
  twist.serialize(writer);
  // Check that the constant length array field [covariance] has the right length
  if (covariance.length != 36) {
    throw Exception('Unable to serialize array field covariance - length must be 36');
  }
  // Serialize message field [covariance]
  writer.writeArray<double>(covariance, (val) => writer.writeFloat64(val), specArrayLen: 36);
}