toJson method
Converts a MetricTarget instance to JSON data.
Implementation
Map<String, Object> toJson() {
final jsonData = <String, Object>{};
final tempAverageUtilization = averageUtilization;
final tempAverageValue = averageValue;
final tempType = type;
final tempValue = value;
if (tempAverageUtilization != null) {
jsonData['averageUtilization'] = tempAverageUtilization;
}
if (tempAverageValue != null) {
jsonData['averageValue'] = tempAverageValue;
}
jsonData['type'] = tempType;
if (tempValue != null) {
jsonData['value'] = tempValue;
}
return jsonData;
}