fromEntityPlus static method

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

Implementation

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

  var counter = 0;
  return DocumentModel(
    documentID: documentID,
    appId: entity.appId ?? '',
    description: entity.description,
    content: entity.content,
    padding: entity.padding,
    images: entity.images == null
        ? null
        : List<DocumentItemModel>.from(
            await Future.wait(entity.images!.map((item) {
            counter++;
            return DocumentItemModel.fromEntityPlus(counter.toString(), item,
                appId: appId);
          }).toList())),
    background:
        await BackgroundModel.fromEntityPlus(entity.background, appId: appId),
    conditions: await StorageConditionsModel.fromEntityPlus(entity.conditions,
        appId: appId),
  );
}