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 tempDeprecatedCountJson = json['deprecatedCount'];
final tempDeprecatedFirstTimestampJson = json['deprecatedFirstTimestamp'];
final tempDeprecatedLastTimestampJson = json['deprecatedLastTimestamp'];
final tempDeprecatedSourceJson = json['deprecatedSource'];
final tempEventTimeJson = json['eventTime'];
final tempKindJson = json['kind'];
final tempMetadataJson = json['metadata'];
final tempNoteJson = json['note'];
final tempReasonJson = json['reason'];
final tempRegardingJson = json['regarding'];
final tempRelatedJson = json['related'];
final tempReportingControllerJson = json['reportingController'];
final tempReportingInstanceJson = json['reportingInstance'];
final tempSeriesJson = json['series'];
final tempTypeJson = json['type'];
final String? tempAction = tempActionJson;
final String? tempApiVersion = tempApiVersionJson;
final int? tempDeprecatedCount = tempDeprecatedCountJson;
final DateTime? tempDeprecatedFirstTimestamp =
tempDeprecatedFirstTimestampJson != null
? DateTime.tryParse(tempDeprecatedFirstTimestampJson)
: null;
final DateTime? tempDeprecatedLastTimestamp =
tempDeprecatedLastTimestampJson != null
? DateTime.tryParse(tempDeprecatedLastTimestampJson)
: null;
final EventSource? tempDeprecatedSource = tempDeprecatedSourceJson != null
? EventSource.fromJson(tempDeprecatedSourceJson)
: null;
final String tempEventTime = tempEventTimeJson;
final String? tempKind = tempKindJson;
final ObjectMeta? tempMetadata =
tempMetadataJson != null ? ObjectMeta.fromJson(tempMetadataJson) : null;
final String? tempNote = tempNoteJson;
final String? tempReason = tempReasonJson;
final ObjectReference? tempRegarding = tempRegardingJson != null
? ObjectReference.fromJson(tempRegardingJson)
: null;
final ObjectReference? tempRelated = tempRelatedJson != null
? ObjectReference.fromJson(tempRelatedJson)
: null;
final String? tempReportingController = tempReportingControllerJson;
final String? tempReportingInstance = tempReportingInstanceJson;
final EventSeries? tempSeries =
tempSeriesJson != null ? EventSeries.fromJson(tempSeriesJson) : null;
final String? tempType = tempTypeJson;
return Event(
action: tempAction,
apiVersion: tempApiVersion,
deprecatedCount: tempDeprecatedCount,
deprecatedFirstTimestamp: tempDeprecatedFirstTimestamp,
deprecatedLastTimestamp: tempDeprecatedLastTimestamp,
deprecatedSource: tempDeprecatedSource,
eventTime: tempEventTime,
kind: tempKind,
metadata: tempMetadata,
note: tempNote,
reason: tempReason,
regarding: tempRegarding,
related: tempRelated,
reportingController: tempReportingController,
reportingInstance: tempReportingInstance,
series: tempSeries,
type: tempType,
);
}