toJson method
Converts a Status instance to JSON data.
Implementation
Map<String, Object> toJson() {
final jsonData = <String, Object>{};
final tempApiVersion = apiVersion;
final tempCode = code;
final tempDetails = details;
final tempKind = kind;
final tempMessage = message;
final tempMetadata = metadata;
final tempReason = reason;
final tempStatus = status;
if (tempApiVersion != null) {
jsonData['apiVersion'] = tempApiVersion;
}
if (tempCode != null) {
jsonData['code'] = tempCode;
}
if (tempDetails != null) {
jsonData['details'] = tempDetails.toJson();
}
if (tempKind != null) {
jsonData['kind'] = tempKind;
}
if (tempMessage != null) {
jsonData['message'] = tempMessage;
}
if (tempMetadata != null) {
jsonData['metadata'] = tempMetadata.toJson();
}
if (tempReason != null) {
jsonData['reason'] = tempReason;
}
if (tempStatus != null) {
jsonData['status'] = tempStatus;
}
return jsonData;
}