fromEntityPlus static method

Future<PostCommentModel?> fromEntityPlus(
  1. String documentID,
  2. PostCommentEntity? entity, {
  3. String? appId,
})

Implementation

static Future<PostCommentModel?> fromEntityPlus(
    String documentID, PostCommentEntity? entity,
    {String? appId}) 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.fromEntityPlus(counter.toString(), item,
                appId: appId);
          }).toList())),
  );
}