fromEntityPlus static method

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

Implementation

static Future<ChatMediumModel?> fromEntityPlus(
    String documentID, ChatMediumEntity? entity,
    {String? appId}) async {
  if (entity == null) return null;

  MemberMediumModel? memberMediumHolder;
  if (entity.memberMediumId != null) {
    try {
      memberMediumHolder = await memberMediumRepository(appId: appId)!
          .get(entity.memberMediumId);
    } on Exception catch (e) {
      print('Error whilst trying to initialise memberMedium');
      print(
          'Error whilst retrieving memberMedium with id ${entity.memberMediumId}');
      print('Exception: $e');
    }
  }

  return ChatMediumModel(
    documentID: documentID,
    memberMedium: memberMediumHolder,
  );
}