toJson method

Map<String, Object> toJson()

Converts a Event instance to JSON data.

Implementation

Map<String, Object> toJson() {
  final jsonData = <String, Object>{};

  final tempAction = action;
  final tempApiVersion = apiVersion;
  final tempDeprecatedCount = deprecatedCount;
  final tempDeprecatedFirstTimestamp = deprecatedFirstTimestamp;
  final tempDeprecatedLastTimestamp = deprecatedLastTimestamp;
  final tempDeprecatedSource = deprecatedSource;
  final tempEventTime = eventTime;
  final tempKind = kind;
  final tempMetadata = metadata;
  final tempNote = note;
  final tempReason = reason;
  final tempRegarding = regarding;
  final tempRelated = related;
  final tempReportingController = reportingController;
  final tempReportingInstance = reportingInstance;
  final tempSeries = series;
  final tempType = type;

  if (tempAction != null) {
    jsonData['action'] = tempAction;
  }

  if (tempApiVersion != null) {
    jsonData['apiVersion'] = tempApiVersion;
  }

  if (tempDeprecatedCount != null) {
    jsonData['deprecatedCount'] = tempDeprecatedCount;
  }

  if (tempDeprecatedFirstTimestamp != null) {
    jsonData['deprecatedFirstTimestamp'] = tempDeprecatedFirstTimestamp;
  }

  if (tempDeprecatedLastTimestamp != null) {
    jsonData['deprecatedLastTimestamp'] = tempDeprecatedLastTimestamp;
  }

  if (tempDeprecatedSource != null) {
    jsonData['deprecatedSource'] = tempDeprecatedSource.toJson();
  }

  jsonData['eventTime'] = tempEventTime;

  if (tempKind != null) {
    jsonData['kind'] = tempKind;
  }

  if (tempMetadata != null) {
    jsonData['metadata'] = tempMetadata.toJson();
  }

  if (tempNote != null) {
    jsonData['note'] = tempNote;
  }

  if (tempReason != null) {
    jsonData['reason'] = tempReason;
  }

  if (tempRegarding != null) {
    jsonData['regarding'] = tempRegarding.toJson();
  }

  if (tempRelated != null) {
    jsonData['related'] = tempRelated.toJson();
  }

  if (tempReportingController != null) {
    jsonData['reportingController'] = tempReportingController;
  }

  if (tempReportingInstance != null) {
    jsonData['reportingInstance'] = tempReportingInstance;
  }

  if (tempSeries != null) {
    jsonData['series'] = tempSeries.toJson();
  }

  if (tempType != null) {
    jsonData['type'] = tempType;
  }

  return jsonData;
}