toJson method
Converts a ContainerStateTerminated instance to JSON data.
Implementation
Map<String, Object> toJson() {
final jsonData = <String, Object>{};
final tempContainerID = containerID;
final tempExitCode = exitCode;
final tempFinishedAt = finishedAt;
final tempMessage = message;
final tempReason = reason;
final tempSignal = signal;
final tempStartedAt = startedAt;
if (tempContainerID != null) {
jsonData['containerID'] = tempContainerID;
}
jsonData['exitCode'] = tempExitCode;
if (tempFinishedAt != null) {
jsonData['finishedAt'] = tempFinishedAt;
}
if (tempMessage != null) {
jsonData['message'] = tempMessage;
}
if (tempReason != null) {
jsonData['reason'] = tempReason;
}
if (tempSignal != null) {
jsonData['signal'] = tempSignal;
}
if (tempStartedAt != null) {
jsonData['startedAt'] = tempStartedAt;
}
return jsonData;
}