fromJson method

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

Implementation

@override
USubjectStatusViewSubject fromJson(Map<String, dynamic> json) {
  try {
    if (RepoRef.validate(json)) {
      return USubjectStatusViewSubject.repoRef(
        data: const RepoRefConverter().fromJson(json),
      );
    }
    if (RepoStrongRef.validate(json)) {
      return USubjectStatusViewSubject.repoStrongRef(
        data: const RepoStrongRefConverter().fromJson(json),
      );
    }
    if (MessageRef.validate(json)) {
      return USubjectStatusViewSubject.messageRef(
        data: const MessageRefConverter().fromJson(json),
      );
    }

    return USubjectStatusViewSubject.unknown(data: json);
  } catch (_) {
    return USubjectStatusViewSubject.unknown(data: json);
  }
}