fromEntity static method

Future<BookletModel?> fromEntity(
  1. String documentID,
  2. BookletEntity? entity
)

Implementation

static Future<BookletModel?> fromEntity(
    String documentID, BookletEntity? entity) 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.fromEntity(counter.toString(), item);
          }).toList())),
    conditions: await StorageConditionsModel.fromEntity(entity.conditions),
  );
}