fromEntity static method

Future<MemberProfileModel?> fromEntity(
  1. String documentID,
  2. MemberProfileEntity? entity
)

Implementation

static Future<MemberProfileModel?> fromEntity(
    String documentID, MemberProfileEntity? entity) async {
  if (entity == null) return null;
  var counter = 0;
  return MemberProfileModel(
    documentID: documentID,
    appId: entity.appId ?? '',
    feedId: entity.feedId,
    authorId: entity.authorId,
    profile: entity.profile,
    profileOverride: entity.profileOverride,
    nameOverride: entity.nameOverride,
    accessibleByGroup:
        toMemberProfileAccessibleByGroup(entity.accessibleByGroup),
    accessibleByMembers: entity.accessibleByMembers,
    readAccess: entity.readAccess,
    memberMedia: entity.memberMedia == null
        ? null
        : List<MemberMediumContainerModel>.from(
            await Future.wait(entity.memberMedia!.map((item) {
            counter++;
            return MemberMediumContainerModel.fromEntity(
                counter.toString(), item);
          }).toList())),
  );
}