import 'dart:convert'; PostModel postModelFromJson(String str) => PostModel.fromJson(json.decode(str)); String postModelToJson(PostModel data) => json.encode(data.toJson()); class PostModel { bool? isSuccess; int? statusCode; String? message; Data? data; dynamic errors; PostModel({ this.isSuccess, this.statusCode, this.message, this.data, this.errors, }); factory PostModel.fromJson(Map json) => PostModel( isSuccess: json["isSuccess"], statusCode: json["statusCode"], message: json["message"], data: json["data"] == null ? null : Data.fromJson(json["data"]), errors: json["errors"], ); Map toJson() => { "isSuccess": isSuccess, "statusCode": statusCode, "message": message, "data": data?.toJson(), "errors": errors, }; } class Data { int? totalCount; List? items; Data({this.totalCount, this.items}); factory Data.fromJson(Map json) => Data( totalCount: json["totalCount"], items: json["items"] == null ? [] : List.from( json["items"]!.map((x) => SocialPostItem.fromJson(x)), ), ); Map toJson() => { "totalCount": totalCount, "items": items == null ? [] : List.from(items!.map((x) => x.toJson())), }; } class SocialPostItem { int? postId; String? userId; String? firstName; String? lastName; String? fullName; String? profilePicture; int? userTypeId; String? userTypeName; String? coachTypeName; int? coachRequestStatus; String? content; int? postTypeId; int? postVisibilityId; int? deviceTypeId; bool? isTribe; dynamic tribeId; DateTime? createdAt; DateTime? updateAt; List? mediaFiles; Poll? poll; List? comments; int? totalPostComments; int? totalPostReactions; dynamic postReactionTypeId; SocialPostItem({ this.postId, this.userId, this.firstName, this.lastName, this.fullName, this.profilePicture, this.userTypeId, this.userTypeName, this.coachTypeName, this.coachRequestStatus, this.content, this.postTypeId, this.postVisibilityId, this.deviceTypeId, this.isTribe, this.tribeId, this.createdAt, this.updateAt, this.mediaFiles, this.poll, this.comments, this.totalPostComments, this.totalPostReactions, this.postReactionTypeId, }); factory SocialPostItem.fromJson(Map json) => SocialPostItem( postId: json["postID"], userId: json["userID"], firstName: json["firstName"], lastName: json["lastName"], fullName: json["fullName"], profilePicture: json["profilePicture"], userTypeId: json["userTypeId"], userTypeName: json["userTypeName"], coachTypeName: json["coachTypeName"], coachRequestStatus: json["coachRequestStatus"], content: json["content"], postTypeId: json["postTypeID"], postVisibilityId: json["postVisibilityID"], deviceTypeId: json["deviceTypeID"], isTribe: json["isTribe"], tribeId: json["tribeID"], createdAt: json["createdAt"] == null ? null : DateTime.parse(json["createdAt"]), updateAt: json["updateAt"] == null ? null : DateTime.parse(json["updateAt"]), mediaFiles: json["mediaFiles"] == null ? [] : List.from( json["mediaFiles"]!.map((x) => MediaFile.fromJson(x)), ), poll: json["poll"] == null ? null : Poll.fromJson(json["poll"]), comments: json["comments"] == null ? [] : List.from(json["comments"]!.map((x) => x)), totalPostComments: json["totalPostComments"], totalPostReactions: json["totalPostReactions"], postReactionTypeId: json["postReactionTypeID"], ); Map toJson() => { "postID": postId, "userID": userId, "firstName": firstName, "lastName": lastName, "fullName": fullName, "profilePicture": profilePicture, "userTypeId": userTypeId, "userTypeName": userTypeName, "coachTypeName": coachTypeName, "coachRequestStatus": coachRequestStatus, "content": content, "postTypeID": postTypeId, "postVisibilityID": postVisibilityId, "deviceTypeID": deviceTypeId, "isTribe": isTribe, "tribeID": tribeId, "createdAt": createdAt?.toIso8601String(), "updateAt": updateAt?.toIso8601String(), "mediaFiles": mediaFiles == null ? [] : List.from(mediaFiles!.map((x) => x.toJson())), "poll": poll?.toJson(), "comments": comments == null ? [] : List.from(comments!.map((x) => x)), "totalPostComments": totalPostComments, "totalPostReactions": totalPostReactions, "postReactionTypeID": postReactionTypeId, }; SocialPostItem copyWith({ int? postId, String? userId, String? firstName, String? lastName, String? fullName, String? profilePicture, int? userTypeId, String? userTypeName, String? coachTypeName, int? coachRequestStatus, String? content, int? postTypeId, int? postVisibilityId, int? deviceTypeId, bool? isTribe, dynamic tribeId, DateTime? createdAt, DateTime? updateAt, List? mediaFiles, Poll? poll, List? comments, int? totalPostComments, int? totalPostReactions, dynamic postReactionTypeId, }) { return SocialPostItem( postId: postId ?? this.postId, userId: userId ?? this.userId, firstName: firstName ?? this.firstName, lastName: lastName ?? this.lastName, fullName: fullName ?? this.fullName, profilePicture: profilePicture ?? this.profilePicture, userTypeId: userTypeId ?? this.userTypeId, userTypeName: userTypeName ?? this.userTypeName, coachTypeName: coachTypeName ?? this.coachTypeName, coachRequestStatus: coachRequestStatus ?? this.coachRequestStatus, content: content ?? this.content, postTypeId: postTypeId ?? this.postTypeId, postVisibilityId: postVisibilityId ?? this.postVisibilityId, deviceTypeId: deviceTypeId ?? this.deviceTypeId, isTribe: isTribe ?? this.isTribe, tribeId: tribeId ?? this.tribeId, createdAt: createdAt ?? this.createdAt, updateAt: updateAt ?? this.updateAt, mediaFiles: mediaFiles ?? this.mediaFiles, poll: poll ?? this.poll, comments: comments ?? this.comments, totalPostComments: totalPostComments ?? this.totalPostComments, totalPostReactions: totalPostReactions ?? this.totalPostReactions, postReactionTypeId: postReactionTypeId ?? this.postReactionTypeId, ); } } class MediaFile { String? mediaFile; String? mediaType; String? thumbnailFile; MediaFile({this.mediaFile, this.mediaType, this.thumbnailFile}); factory MediaFile.fromJson(Map json) => MediaFile( mediaFile: json["mediaFile"], mediaType: json["mediaType"], thumbnailFile: json["thumbnailFile"], ); Map toJson() => { "mediaFile": mediaFile, "mediaType": mediaType, "thumbnailFile": thumbnailFile, }; } class Poll { int? pollPostId; String? question; DateTime? expiryDate; List