toJson method
Converts this schema object to its JSON representation.
Implementations should return a map containing the required fields according to the OpenMHealth standard for the specific schema type.
@return A map containing the JSON representation of this schema.
Implementation
@override
Map<String, dynamic> toJson() {
Map<String, dynamic> result = {
"heartRateVariability": heartRateVariability.toJson(),
"algorithm": algorithm.value,
"effectiveTimeFrame": effectiveTimeFrame.toJson(),
};
if (algorithmDetails != null) {
result["algorithmDetails"] = algorithmDetails;
}
if (measurementMethod != null) {
result["measurementMethod"] = measurementMethod!.value;
}
if (descriptiveStatistic != null) {
result["descriptiveStatistic"] = descriptiveStatistic!.toJson();
}
if (temporalRelationshipToPhysicalActivity != null) {
result["temporalRelationshipToPhysicalActivity"] = temporalRelationshipToPhysicalActivity!.value;
}
if (temporalRelationshipToSleep != null) {
result["temporalRelationshipToSleep"] = temporalRelationshipToSleep!.jsonValue;
}
return result;
}