fromJson method

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

Implementation

@override
UReplyRefParent fromJson(Map<String, dynamic> json) {
  try {
    if (isPostView(json)) {
      return UReplyRefParent.postView(
        data: const PostViewConverter().fromJson(json),
      );
    }
    if (isNotFoundPost(json)) {
      return UReplyRefParent.notFoundPost(
        data: const NotFoundPostConverter().fromJson(json),
      );
    }
    if (isBlockedPost(json)) {
      return UReplyRefParent.blockedPost(
        data: const BlockedPostConverter().fromJson(json),
      );
    }

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