fromEntityPlus static method

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

Implementation

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

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

  return SimpleImageModel(
    documentID: documentID,
    appId: entity.appId ?? '',
    description: entity.description,
    image: imageHolder,
    conditions: await StorageConditionsModel.fromEntityPlus(entity.conditions,
        appId: appId),
  );
}