toJson method
Implementation
Map<String, dynamic> toJson() => {
'batteryPercentage': batteryPercentage,
'status': status.value,
'health': health.value,
'temperature': temperature,
'voltage': voltage,
'cycleCount': cycleCount,
'chargingStatus': chargingStatus,
'capacityLevel': capacityLevel.value,
'technology': technology,
if (batteryUsageNumber != null) 'batteryUsageNumber': batteryUsageNumber,
if (batteryErrorStatus != null) 'batteryErrorStatus': batteryErrorStatus,
if (batteryType != null) 'batteryType': batteryType,
if (batteryUsageDecommissionThreshold != null) 'batteryUsageDecommissionThreshold': batteryUsageDecommissionThreshold,
'iconSmall': iconSmall,
'maxChargingVoltage': maxChargingVoltage,
if (zcmMode != null) 'zcmMode': zcmMode,
if (shutdownLevel != null) 'shutdownLevel': shutdownLevel,
if (zcmEnabled != null) 'zcmEnabled': zcmEnabled,
if (maxDischargeTempShutdownLevel != null) 'maxDischargeTempShutdownLevel': maxDischargeTempShutdownLevel,
'maxChargingCurrent': maxChargingCurrent,
if (adjustShutdownLevel != null) 'adjustShutdownLevel': adjustShutdownLevel,
if (lowLevel != null) 'lowLevel': lowLevel,
if (ratedCapacity != null) 'ratedCapacity': ratedCapacity,
'plugged': plugged,
'present': present,
if (mfd != null) 'mfd': mfd?.toIso8601String(),
'seq': seq,
if (zcmExtra != null) 'zcmExtra': zcmExtra,
'chargeCounter': chargeCounter,
'level': level,
if (baseCumulativeCharge != null) 'baseCumulativeCharge': baseCumulativeCharge,
'scale': scale,
if (partNumber != null) 'partNumber': partNumber,
if (criticalLevel != null) 'criticalLevel': criticalLevel,
if (minDischargeTempShutdownLevel != null) 'minDischargeTempShutdownLevel': minDischargeTempShutdownLevel,
'batteryLow': batteryLow,
if (serialNumber != null) 'serialNumber': serialNumber,
'invalidCharger': invalidCharger,
if (batteryDecommissionStatus != null) 'batteryDecommissionStatus': batteryDecommissionStatus?.value,
if (batterySwapping != null) 'batterySwapping': batterySwapping,
if (backupBatteryVoltage != null) 'backupBatteryVoltage': backupBatteryVoltage,
if (currentEvent != null) 'currentEvent': currentEvent,
if (miscEvent != null) 'miscEvent': miscEvent,
if (online != null) 'online': online,
if (pogoPlugged != null) 'pogoPlugged': pogoPlugged,
if (capacity != null) 'capacity': capacity,
if (currentNow != null) 'currentNow': currentNow,
if (chargeType != null) 'chargeType': chargeType,
if (hvCharger != null) 'hvCharger': hvCharger,
if (powerSharing != null) 'powerSharing': powerSharing,
if (chargerType != null) 'chargerType': chargerType,
if (extraMap?.isNotEmpty == true) 'extraMap': extraMap,
if (intentLog != null) 'intentLog': intentLog,
if (minBatteryTemp != null) 'minBatteryTemp': minBatteryTemp,
if (maxBatteryTemp != null) 'maxBatteryTemp': maxBatteryTemp,
if (batteryPercentDecommissionThreshold != null) 'batteryPercentDecommissionThreshold': batteryPercentDecommissionThreshold,
if (chargingDuration != null) 'chargingDuration': chargingDuration,
if (timeSinceLastCharge != null) 'timeSinceLastCharge': timeSinceLastCharge,
if (lastChargeLength != null) 'lastChargeLength': lastChargeLength,
if (timeRemaining != null) 'timeRemaining': timeRemaining,
if (rebootCount != null) 'rebootCount': rebootCount,
if (deviceOffDuration != null) 'deviceOffDuration': deviceOffDuration,
if (deviceOnDuration != null) 'deviceOnDuration': deviceOnDuration,
if (timeSinceLastFullCharge != null) 'timeSinceLastFullCharge': timeSinceLastFullCharge,
if (backupPowerType != null) 'backupPowerType': backupPowerType,
if (usbLiquidStatus != null) 'usbLiquidStatus': usbLiquidStatus,
if (presentCapacity != null) 'presentCapacity': presentCapacity,
if (healthPercentage != null) 'healthPercentage': healthPercentage,
if (timeToEmpty != null) 'timeToEmpty': timeToEmpty,
if (timeToFull != null) 'timeToFull': timeToFull,
if (presentCharge != null) 'presentCharge': presentCharge,
'createdAt': createdAt.toIso8601String(),
};