fromJson method

  1. @override
UModEventViewEvent fromJson(
  1. Map<String, dynamic> json
)

Implementation

@override
UModEventViewEvent fromJson(Map<String, dynamic> json) {
  if (ModEventTakedown.validate(json)) {
    return UModEventViewEvent.modEventTakedown(
      data: const ModEventTakedownConverter().fromJson(json),
    );
  }
  if (ModEventReverseTakedown.validate(json)) {
    return UModEventViewEvent.modEventReverseTakedown(
      data: const ModEventReverseTakedownConverter().fromJson(json),
    );
  }
  if (ModEventComment.validate(json)) {
    return UModEventViewEvent.modEventComment(
      data: const ModEventCommentConverter().fromJson(json),
    );
  }
  if (ModEventReport.validate(json)) {
    return UModEventViewEvent.modEventReport(
      data: const ModEventReportConverter().fromJson(json),
    );
  }
  if (ModEventLabel.validate(json)) {
    return UModEventViewEvent.modEventLabel(
      data: const ModEventLabelConverter().fromJson(json),
    );
  }
  if (ModEventAcknowledge.validate(json)) {
    return UModEventViewEvent.modEventAcknowledge(
      data: const ModEventAcknowledgeConverter().fromJson(json),
    );
  }
  if (ModEventEscalate.validate(json)) {
    return UModEventViewEvent.modEventEscalate(
      data: const ModEventEscalateConverter().fromJson(json),
    );
  }
  if (ModEventMute.validate(json)) {
    return UModEventViewEvent.modEventMute(
      data: const ModEventMuteConverter().fromJson(json),
    );
  }
  if (ModEventUnmute.validate(json)) {
    return UModEventViewEvent.modEventUnmute(
      data: const ModEventUnmuteConverter().fromJson(json),
    );
  }
  if (ModEventMuteReporter.validate(json)) {
    return UModEventViewEvent.modEventMuteReporter(
      data: const ModEventMuteReporterConverter().fromJson(json),
    );
  }
  if (ModEventUnmuteReporter.validate(json)) {
    return UModEventViewEvent.modEventUnmuteReporter(
      data: const ModEventUnmuteReporterConverter().fromJson(json),
    );
  }
  if (ModEventEmail.validate(json)) {
    return UModEventViewEvent.modEventEmail(
      data: const ModEventEmailConverter().fromJson(json),
    );
  }
  if (ModEventResolveAppeal.validate(json)) {
    return UModEventViewEvent.modEventResolveAppeal(
      data: const ModEventResolveAppealConverter().fromJson(json),
    );
  }
  if (ModEventDivert.validate(json)) {
    return UModEventViewEvent.modEventDivert(
      data: const ModEventDivertConverter().fromJson(json),
    );
  }
  if (ModEventTag.validate(json)) {
    return UModEventViewEvent.modEventTag(
      data: const ModEventTagConverter().fromJson(json),
    );
  }
  if (AccountEvent.validate(json)) {
    return UModEventViewEvent.accountEvent(
      data: const AccountEventConverter().fromJson(json),
    );
  }
  if (IdentityEvent.validate(json)) {
    return UModEventViewEvent.identityEvent(
      data: const IdentityEventConverter().fromJson(json),
    );
  }
  if (RecordEvent.validate(json)) {
    return UModEventViewEvent.recordEvent(
      data: const RecordEventConverter().fromJson(json),
    );
  }
  if (ModEventPriorityScore.validate(json)) {
    return UModEventViewEvent.modEventPriorityScore(
      data: const ModEventPriorityScoreConverter().fromJson(json),
    );
  }
  if (AgeAssuranceEvent.validate(json)) {
    return UModEventViewEvent.ageAssuranceEvent(
      data: const AgeAssuranceEventConverter().fromJson(json),
    );
  }
  if (AgeAssuranceOverrideEvent.validate(json)) {
    return UModEventViewEvent.ageAssuranceOverrideEvent(
      data: const AgeAssuranceOverrideEventConverter().fromJson(json),
    );
  }
  if (AgeAssurancePurgeEvent.validate(json)) {
    return UModEventViewEvent.ageAssurancePurgeEvent(
      data: const AgeAssurancePurgeEventConverter().fromJson(json),
    );
  }
  if (RevokeAccountCredentialsEvent.validate(json)) {
    return UModEventViewEvent.revokeAccountCredentialsEvent(
      data: const RevokeAccountCredentialsEventConverter().fromJson(json),
    );
  }
  if (ScheduleTakedownEvent.validate(json)) {
    return UModEventViewEvent.scheduleTakedownEvent(
      data: const ScheduleTakedownEventConverter().fromJson(json),
    );
  }
  if (CancelScheduledTakedownEvent.validate(json)) {
    return UModEventViewEvent.cancelScheduledTakedownEvent(
      data: const CancelScheduledTakedownEventConverter().fromJson(json),
    );
  }

  // No known `$type` matched: preserve the payload verbatim as an unknown
  // variant. A payload whose `$type` *does* match a known ref but fails to
  // convert is intentionally left to throw, so malformed data surfaces
  // instead of being silently degraded to `.unknown`.
  return UModEventViewEvent.unknown(data: json);
}