fromEntityPlus static method

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

Implementation

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

  PlatformMediumModel? mediumHolder;
  if (entity.mediumId != null) {
    try {
      mediumHolder =
          await platformMediumRepository(appId: appId)!.get(entity.mediumId);
    } on Exception catch (e) {
      print('Error whilst trying to initialise medium');
      print(
          'Error whilst retrieving platformMedium with id ${entity.mediumId}');
      print('Exception: $e');
    }
  }

  return AlbumEntryModel(
    documentID: documentID,
    name: entity.name,
    medium: mediumHolder,
  );
}