fromEntity static method

Future<PageModel?> fromEntity(
  1. String documentID,
  2. PageEntity? entity
)

Implementation

static Future<PageModel?> fromEntity(
    String documentID, PageEntity? entity) async {
  if (entity == null) return null;
  var counter = 0;
  return PageModel(
    documentID: documentID,
    appId: entity.appId ?? '',
    description: entity.description,
    title: entity.title,
    bodyComponents: entity.bodyComponents == null
        ? null
        : List<BodyComponentModel>.from(
            await Future.wait(entity.bodyComponents!.map((item) {
            counter++;
            return BodyComponentModel.fromEntity(counter.toString(), item);
          }).toList())),
    backgroundOverride:
        await BackgroundModel.fromEntity(entity.backgroundOverride),
    layout: toPageLayout(entity.layout),
    conditions: await StorageConditionsModel.fromEntity(entity.conditions),
  );
}