fromEntityPlus static method

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

Implementation

static Future<DocumentItemModel?> fromEntityPlus(
    String documentID, DocumentItemEntity? 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 DocumentItemModel(
    documentID: documentID,
    reference: entity.reference,
    image: imageHolder,
  );
}