fromJson method

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

Implementation

@override
UThreadViewPostReply fromJson(Map<String, dynamic> json) {
  try {
    if (isThreadViewPost(json)) {
      return UThreadViewPostReply.threadViewPost(
        data: const ThreadViewPostConverter().fromJson(json),
      );
    }
    if (isNotFoundPost(json)) {
      return UThreadViewPostReply.notFoundPost(
        data: const NotFoundPostConverter().fromJson(json),
      );
    }
    if (isBlockedPost(json)) {
      return UThreadViewPostReply.blockedPost(
        data: const BlockedPostConverter().fromJson(json),
      );
    }

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