fromEntityPlus static method
Future<FollowRequestModel?>
fromEntityPlus(
- String documentID,
- FollowRequestEntity? entity, {
- String? appId,
Implementation
static Future<FollowRequestModel?> fromEntityPlus(
String documentID, FollowRequestEntity? entity,
{String? appId}) async {
if (entity == null) return null;
MemberPublicInfoModel? followerHolder;
if (entity.followerId != null) {
try {
followerHolder = await memberPublicInfoRepository(appId: appId)!
.get(entity.followerId);
} on Exception catch (e) {
print('Error whilst trying to initialise follower');
print(
'Error whilst retrieving memberPublicInfo with id ${entity.followerId}');
print('Exception: $e');
}
}
MemberPublicInfoModel? followedHolder;
if (entity.followedId != null) {
try {
followedHolder = await memberPublicInfoRepository(appId: appId)!
.get(entity.followedId);
} on Exception catch (e) {
print('Error whilst trying to initialise followed');
print(
'Error whilst retrieving memberPublicInfo with id ${entity.followedId}');
print('Exception: $e');
}
}
return FollowRequestModel(
documentID: documentID,
appId: entity.appId ?? '',
follower: followerHolder,
followed: followedHolder,
status: toFollowRequestStatus(entity.status),
);
}