Event.fromJson constructor
Creates a Event from JSON data.
Implementation
factory Event.fromJson(Map<String, dynamic> json) {
final tempActionJson = json['action'];
final tempApiVersionJson = json['apiVersion'];
final tempCountJson = json['count'];
final tempEventTimeJson = json['eventTime'];
final tempFirstTimestampJson = json['firstTimestamp'];
final tempInvolvedObjectJson = json['involvedObject'];
final tempKindJson = json['kind'];
final tempLastTimestampJson = json['lastTimestamp'];
final tempMessageJson = json['message'];
final tempMetadataJson = json['metadata'];
final tempReasonJson = json['reason'];
final tempRelatedJson = json['related'];
final tempReportingComponentJson = json['reportingComponent'];
final tempReportingInstanceJson = json['reportingInstance'];
final tempSeriesJson = json['series'];
final tempSourceJson = json['source'];
final tempTypeJson = json['type'];
final String? tempAction = tempActionJson;
final String? tempApiVersion = tempApiVersionJson;
final int? tempCount = tempCountJson;
final String? tempEventTime = tempEventTimeJson;
final DateTime? tempFirstTimestamp = tempFirstTimestampJson != null
? DateTime.tryParse(tempFirstTimestampJson)
: null;
final ObjectReference tempInvolvedObject =
ObjectReference.fromJson(tempInvolvedObjectJson);
final String? tempKind = tempKindJson;
final DateTime? tempLastTimestamp = tempLastTimestampJson != null
? DateTime.tryParse(tempLastTimestampJson)
: null;
final String? tempMessage = tempMessageJson;
final ObjectMeta tempMetadata = ObjectMeta.fromJson(tempMetadataJson);
final String? tempReason = tempReasonJson;
final ObjectReference? tempRelated = tempRelatedJson != null
? ObjectReference.fromJson(tempRelatedJson)
: null;
final String? tempReportingComponent = tempReportingComponentJson;
final String? tempReportingInstance = tempReportingInstanceJson;
final EventSeries? tempSeries =
tempSeriesJson != null ? EventSeries.fromJson(tempSeriesJson) : null;
final EventSource? tempSource =
tempSourceJson != null ? EventSource.fromJson(tempSourceJson) : null;
final String? tempType = tempTypeJson;
return Event(
action: tempAction,
apiVersion: tempApiVersion,
count: tempCount,
eventTime: tempEventTime,
firstTimestamp: tempFirstTimestamp,
involvedObject: tempInvolvedObject,
kind: tempKind,
lastTimestamp: tempLastTimestamp,
message: tempMessage,
metadata: tempMetadata,
reason: tempReason,
related: tempRelated,
reportingComponent: tempReportingComponent,
reportingInstance: tempReportingInstance,
series: tempSeries,
source: tempSource,
type: tempType,
);
}