fromEntity static method
Implementation
static Future<PostCommentModel?> fromEntity(
String documentID, PostCommentEntity? entity) async {
if (entity == null) return null;
var counter = 0;
return PostCommentModel(
documentID: documentID,
postId: entity.postId,
postCommentId: entity.postCommentId,
memberId: entity.memberId,
timestamp: entity.timestamp == null
? null
: DateTime.fromMillisecondsSinceEpoch((entity.timestamp as int)),
appId: entity.appId ?? '',
comment: entity.comment,
likes: entity.likes,
dislikes: entity.dislikes,
memberMedia: entity.memberMedia == null
? null
: List<MemberMediumModel>.from(
await Future.wait(entity.memberMedia!.map((item) {
counter++;
return MemberMediumModel.fromEntity(counter.toString(), item);
}).toList())),
);
}