fromEntityPlus static method

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

Implementation

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

  var counter = 0;
  return BookletModel(
    documentID: documentID,
    appId: entity.appId ?? '',
    description: entity.description,
    sections: entity.sections == null
        ? null
        : List<SectionModel>.from(
            await Future.wait(entity.sections!.map((item) {
            counter++;
            return SectionModel.fromEntityPlus(counter.toString(), item,
                appId: appId);
          }).toList())),
    conditions: await StorageConditionsModel.fromEntityPlus(entity.conditions,
        appId: appId),
  );
}