Post.fromJSON constructor

Post.fromJSON(
  1. dynamic data
)

Implementation

Post.fromJSON(data) :
      id = data["id"] ?? "",
      ownerId = data["ownerId"] ?? "",
      profileName = data["profileName"] ?? "",
      profileImgUrl = data["profileImgUrl"] ?? "",
      caption = data["caption"] ?? "",
      type = EnumToString.fromString(PostType.values, data["type"] ?? PostType.caption.name) ?? PostType.caption,
      mediaUrl = data["mediaUrl"] ?? "",
      thumbnailUrl = data["thumbnailUrl"] ?? "",
      createdTime = data["createdTime"] ?? 0,
      modifiedTime = data["modifiedTime"] ?? 0,
      position = CoreUtilities.JSONtoPosition(data["position"]),
      location = data["location"] ?? "",
      likedProfiles = List.from(data["likedProfiles"] ?? []),
      sharedProfiles = List.from(data["sharedProfiles"] ?? []),
      mentionedProfiles = List.from(data["mentionedProfiles"] ?? []),
      commentIds = List.from(data["commentIds"] ?? []),
      comments = [],
      hashtags = List.from(data["hashtags"] ?? []),
      isCommentEnabled = data["isCommentEnabled"] ?? true,
      isPrivate = data["isPrivate"] ?? false,
      isDraft = data["isDraft"] ?? false,
      isHidden = data["isHidden"] ?? false,
      verificationLevel = EnumToString.fromString(VerificationLevel.values, data["verificationLevel"] ?? VerificationLevel.none.name) ?? VerificationLevel.none,
      mediaOwner = data["mediaOwner"] ?? "",
      referenceId = data["referenceId"] ?? "",
      lastInteraction = data["lastInteraction"] ?? 0,
      aspectRatio = data["aspectRatio"] ?? 1;